File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed
Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff 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>();
Original file line number Diff line number Diff line change @@ -17,10 +17,10 @@ public static void ConfigureCohortEndpoints(this WebApplication app)
1717 var cohorts = app . MapGroup ( "cohorts" ) ;
1818 cohorts . MapPost ( "/" , CreateCohort ) . WithSummary ( "Create a cohort" ) ;
1919 cohorts . MapGet ( "/" , GetAllCohorts ) . WithSummary ( "Get all cohorts" ) ;
20- cohorts . MapGet ( "/{id }" , GetCohort ) . WithSummary ( "Get a cohort by ID" ) ;
20+ cohorts . MapGet ( "/cohortId/{cohortId }" , GetCohort ) . WithSummary ( "Get a cohort by ID" ) ;
2121 //cohorts.MapGet("/{userId}", GetCohortByUserId).WithSummary("");
22- cohorts . MapPost ( "/{cohortId}/{userId}/{courseId}" , AddUserToCohort ) . WithSummary ( "Add a user to a cohort" ) ;
23- cohorts . MapDelete ( "/{cohortId}/{userId}/{courseId}" , DeleteUserFromCohort ) . WithSummary ( "Delete a user from a cohort" ) ;
22+ cohorts . MapPost ( "/cohortId/ {cohortId}/userId/ {userId}/courseId /{courseId}" , AddUserToCohort ) . WithSummary ( "Add a user to a cohort" ) ;
23+ cohorts . MapDelete ( "/cohortId/ {cohortId}/userId/ {userId}/courseId /{courseId}" , DeleteUserFromCohort ) . WithSummary ( "Delete a user from a cohort" ) ;
2424 }
2525
2626 [ ProducesResponseType ( StatusCodes . Status200OK ) ]
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments