Resolve InternshipType List in Edition problem

This commit is contained in:
mborzyszkowski 2020-09-05 20:50:22 +02:00
parent 296075a3b4
commit 655b084c96
5 changed files with 28 additions and 16 deletions

View File

@ -38,7 +38,7 @@ namespace InternshipSystem.Api.Controllers
.ToListAsync(cancellationToken); .ToListAsync(cancellationToken);
/// <summary> /// <summary>
/// Get companies matching provided paginated query /// Get company branches matching provided paginated query
/// </summary> /// </summary>
/// <param name="searchQuery">Paginated query description</param> /// <param name="searchQuery">Paginated query description</param>
/// <param name="companyId"></param> /// <param name="companyId"></param>

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using InternshipSystem.Core.Entity.Internship; using InternshipSystem.Core.Entity.Internship;
using InternshipSystem.Core.UglyOrmArtifacts; using InternshipSystem.Core.UglyOrmArtifacts;
@ -14,7 +15,7 @@ namespace InternshipSystem.Core
public Course Course { get; set; } public Course Course { get; set; }
public List<Internship> Internships { get; set; } public List<Internship> Internships { get; set; }
public List<EditionSubject> AvailableSubjects { get; set; } public List<EditionSubject> AvailableSubjects { get; set; }
public List<InternshipType> AvailableInternshipTypes { get; set; } public List<EditionInternshipType> AvailableInternshipTypes { get; set; }
public bool IsOpen => EditionFinish < DateTime.Today; public bool IsOpen => EditionFinish < DateTime.Today;
@ -30,7 +31,7 @@ namespace InternshipSystem.Core
public bool IsInternshipTypeAllowed(InternshipType registrationQueryType) public bool IsInternshipTypeAllowed(InternshipType registrationQueryType)
{ {
return AvailableInternshipTypes.Contains(registrationQueryType); return AvailableInternshipTypes.Select(it => it.InternshipType).Contains(registrationQueryType);
} }
public void RegisterInternship(Student student) public void RegisterInternship(Student student)

View File

@ -2,13 +2,13 @@
{ {
public enum InternshipType public enum InternshipType
{ {
FreeInternship, FreeInternship = 0,
GraduateInternship, GraduateInternship = 1,
FreeApprenticeship, FreeApprenticeship = 2,
PaidApprenticeship, PaidApprenticeship = 3,
ForeignInternship, ForeignInternship = 4,
UOP, UOP = 5,
UD, UD = 6,
UZ UZ = 7,
} }
} }

View File

@ -0,0 +1,11 @@
using System;
using InternshipSystem.Core.Entity.Internship;
namespace InternshipSystem.Core.UglyOrmArtifacts
{
public class EditionInternshipType
{
public long Id { get; set; }
public InternshipType InternshipType { get; set; }
}
}

View File

@ -139,12 +139,12 @@ namespace InternshipSystem.Repository
{ {
Name = "Informatyka", Name = "Informatyka",
}, },
AvailableInternshipTypes = new List<InternshipType> AvailableInternshipTypes = new List<EditionInternshipType>
{ {
InternshipType.UOP, new EditionInternshipType() { InternshipType = InternshipType.UOP },
InternshipType.UZ, new EditionInternshipType() { InternshipType = InternshipType.UZ },
InternshipType.UD, new EditionInternshipType() { InternshipType = InternshipType.UD },
InternshipType.FreeInternship new EditionInternshipType() { InternshipType = InternshipType.FreeInternship },
}, },
Internships = new List<Internship>(), Internships = new List<Internship>(),
} }