Пример #1
0
        public async Task <IActionResult> Delete([FromRoute] Guid lessonId)
        {
            var userOwnLesson = await _LessonService.UserOwnsLesson(lessonId, HttpContext.GetUserId());

            if (!userOwnLesson)
            {
                return(BadRequest(new { error = "You do not own this lesson" }));
            }

            var deleted = await _LessonService.DeleteLesson(lessonId);

            if (deleted)
            {
                return(NoContent());
            }

            return(NotFound());
        }
Пример #2
0
 public void DeleteLesson([FromQuery] int lessonId)
 {
     _service.DeleteLesson(lessonId);
 }
Пример #3
0
        public async Task DeleteLesson([FromQuery] string id)
        {
            var model = await _lessonService.GetLessonById(id);

            await _lessonService.DeleteLesson(model);
        }
Пример #4
0
        public async Task <string> DeleteLesson(int lessonId)
        {
            await lessonService.DeleteLesson(lessonId);

            return("Done!");
        }