Beispiel #1
0
        public async Task <IResult> AddCourse(CourseCrudDto courseCrudDto)
        {
            var course = _mapper.Map <Entities.Concrete.Course>(courseCrudDto);
            await _courseRepository.CreateCourse(course);

            return(new SuccessResult(Messages.CourseAdded));
        }
Beispiel #2
0
        public async Task <IResult> UpdateCourse(CourseCrudDto courseCrudDto)
        {
            var course = _mapper.Map <Entities.Concrete.Course>(courseCrudDto);
            var query  = await _courseRepository.UpdateCourse(course);

            if (query)
            {
                return(new SuccessResult(Messages.CourseUpdated));
            }
            return(new ErrorResult("Kurs Güncellenemedi"));
        }
Beispiel #3
0
        public async Task <IActionResult> Update(CourseCrudDto courseCrudDto)
        {
            var response = await _courseService.UpdateCourse(courseCrudDto);

            if (response.IsSuccess)
            {
                return(Ok(response));
            }

            return(BadRequest(response));
        }