Esempio n. 1
0
        public async Task <CourseSessionDTO> Edit(CourseSessionDTO dto)
        {
            dto.StartDate = dto.StartDate.AddDays(1);
            dto.EndDate   = dto.EndDate.AddDays(1);
            var courseSession = dto.MapTo <TCourseSession>();
            await courseSessionRepository.Edit(courseSession, Session);

            return(courseSession.MapTo <CourseSessionDTO>());
        }
Esempio n. 2
0
        public async Task <IActionResult> PutCourseSession(CourseSessionDTO courseSessionDto)
        {
            var courseSession = await courseSessionService.Edit(courseSessionDto);

            if (courseSession == null)
            {
                return(BadRequest());
            }

            return(Ok(courseSession));
        }
Esempio n. 3
0
        public async Task <ActionResult <CourseSessionDTO> > PostCourseSession(CourseSessionDTO courseSessionDTO)
        {
            if (await courseSessionService.ClearToSession(courseSessionDTO.CourseId, courseSessionDTO.StartDate, courseSessionDTO.EndDate))
            {
                var courseSession = await courseSessionService.Edit(courseSessionDTO);

                if (courseSession == null)
                {
                    return(BadRequest("ghi hak"));
                }

                return(Ok(courseSession));
            }

            return(BadRequest("change interval"));
        }