private async Task TestEntityDelete(Lesson lessonToDelete) { List <Lesson> actualLessons = await lessonStorage.GetAllLesson(); lessonStorage.DeleteLesson((int)lessonToDelete.Id); List <Lesson> actualLessons1 = await lessonStorage.GetAllLesson(); Assert.AreEqual(actualLessons.Count - 1, actualLessons1.Count); for (int i = 0; i < listLesson.Count; i++) { Assert.AreNotEqual(actualLessons1[i].Id, (int)lessonToDelete.Id); } }
[HttpDelete("{id}")] // api/lesson/735 public async Task <ActionResult> DeleteLessonById(int id) { await lessonStorage.DeleteLesson(id); return(Ok()); }