| | 1 | | using Syki.Back.Features.Academic.CreateCourse; |
| | 2 | | using Syki.Back.Features.Academic.CreateDiscipline; |
| | 3 | |
|
| | 4 | | namespace Syki.Back.Features.Academic.CreateCourseCurriculum; |
| | 5 | |
|
| | 6 | | /// <summary> |
| | 7 | | /// Grade Curricular de um Curso. |
| | 8 | | /// Um mesmo Curso pode possuir diversas Grades diferentes. |
| | 9 | | /// </summary> |
| | 10 | | public class CourseCurriculum |
| | 11 | | { |
| 1147 | 12 | | public Guid Id { get; set; } |
| 698 | 13 | | public Guid InstitutionId { get; set; } |
| 925 | 14 | | public Guid CourseId { get; set; } |
| 228 | 15 | | public Course Course { get; set; } |
| 1137 | 16 | | public string Name { get; set; } |
| 928 | 17 | | public List<Discipline> Disciplines { get; set; } |
| 2728 | 18 | | public List<CourseCurriculumDiscipline> Links { get; set; } |
| | 19 | |
|
| 698 | 20 | | public CourseCurriculum( |
| 698 | 21 | | Guid institutionId, |
| 698 | 22 | | Guid courseId, |
| 698 | 23 | | string name |
| 698 | 24 | | ) { |
| 698 | 25 | | Id = Guid.NewGuid(); |
| 698 | 26 | | InstitutionId = institutionId; |
| 698 | 27 | | CourseId = courseId; |
| 698 | 28 | | Name = name; |
| 698 | 29 | | Disciplines = []; |
| 698 | 30 | | Links = []; |
| 698 | 31 | | } |
| | 32 | |
|
| | 33 | | public CourseCurriculumOut ToOut() |
| | 34 | | { |
| 226 | 35 | | var result = new CourseCurriculumOut |
| 226 | 36 | | { |
| 226 | 37 | | Id = Id, |
| 226 | 38 | | CourseId = CourseId, |
| 226 | 39 | | CourseName = Course.Name, |
| 226 | 40 | | Name = Name, |
| 1763 | 41 | | Disciplines = Disciplines.ConvertAll(d => d.ToOut()), |
| 226 | 42 | | }; |
| | 43 | |
|
| 3978 | 44 | | foreach (var link in Links) |
| | 45 | | { |
| 11364 | 46 | | var discipline = result.Disciplines.First(x => x.Id == link.DisciplineId); |
| 1763 | 47 | | discipline.Period = link.Period; |
| 1763 | 48 | | discipline.Credits = link.Credits; |
| 1763 | 49 | | discipline.Workload = link.Workload; |
| | 50 | | } |
| | 51 | |
|
| 226 | 52 | | return result; |
| | 53 | | } |
| | 54 | | } |