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);
/// <summary>
/// Get companies matching provided paginated query
/// Get company branches matching provided paginated query
/// </summary>
/// <param name="searchQuery">Paginated query description</param>
/// <param name="companyId"></param>

View File

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

View File

@ -2,13 +2,13 @@
{
public enum InternshipType
{
FreeInternship,
GraduateInternship,
FreeApprenticeship,
PaidApprenticeship,
ForeignInternship,
UOP,
UD,
UZ
FreeInternship = 0,
GraduateInternship = 1,
FreeApprenticeship = 2,
PaidApprenticeship = 3,
ForeignInternship = 4,
UOP = 5,
UD = 6,
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",
},
AvailableInternshipTypes = new List<InternshipType>
AvailableInternshipTypes = new List<EditionInternshipType>
{
InternshipType.UOP,
InternshipType.UZ,
InternshipType.UD,
InternshipType.FreeInternship
new EditionInternshipType() { InternshipType = InternshipType.UOP },
new EditionInternshipType() { InternshipType = InternshipType.UZ },
new EditionInternshipType() { InternshipType = InternshipType.UD },
new EditionInternshipType() { InternshipType = InternshipType.FreeInternship },
},
Internships = new List<Internship>(),
}