예제 #1
0
        public async Task <ActionResult <CourseDto> > CreateCourse(CourseAddDto course)
        {
            var entity = _mapper.Map <Course>(course);

            _courseRepository.AddCourse(entity);
            await _courseRepository.SaveAsync();

            var returnDto = _mapper.Map <CourseDto>(entity);

            return(CreatedAtRoute(nameof(GetCourse), new { courseId = returnDto.Id }, returnDto));
        }