Exemple #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());
        }
Exemple #2
0
 public void DeleteLesson([FromQuery] int lessonId)
 {
     _service.DeleteLesson(lessonId);
 }
Exemple #3
0
        public async Task DeleteLesson([FromQuery] string id)
        {
            var model = await _lessonService.GetLessonById(id);

            await _lessonService.DeleteLesson(model);
        }
Exemple #4
0
        public async Task <string> DeleteLesson(int lessonId)
        {
            await lessonService.DeleteLesson(lessonId);

            return("Done!");
        }