Skip to content

Commit 79981ca

Browse files
author
Roman Eriksen
committed
Added course Id to the response
1 parent 16dc8a0 commit 79981ca

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

exercise.wwwapi/DTOs/Cohort/CourseInCohortDTO.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ namespace exercise.wwwapi.DTOs.Cohort
55
public class CourseInCohortDTO
66
{
77
public string Title { get; set; }
8+
public int Id { get; set; }
9+
810
public ICollection<UserBasicDTO> Students { get; set; } = new List<UserBasicDTO>();
911
public ICollection<UserBasicDTO> Teachers { get; set; } = new List<UserBasicDTO>();
1012
//public ICollection<UserCohortDTO> Students { get; set; } = new List<UserCohortDTO>();

exercise.wwwapi/Tools/MappingProfile.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public MappingProfile()
2323
.ForMember(dest => dest.Cohort, opt => opt.MapFrom(src => src.Cohort.Title));
2424

2525
CreateMap<CohortCourse, CourseInCohortDTO>()
26+
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.CourseId))
2627
.ForMember(dest => dest.Title, opt => opt.MapFrom(src => src.Course.Title))
2728
.ForMember(dest => dest.Students, opt => opt.MapFrom(
2829
src => src.CohortCourseUsers

0 commit comments

Comments
 (0)