/* public IActionResult Delete(string id) * { * var book = _chapterService.Get(id); * * if (book == null) * { * return NotFound(); * } * * _chapterService.Remove(book.Id); * * return NoContent(); * } */ public async Task <ActionResult> DeleteChapter(string id) { var isDeleted = await _chapterService.DeleteChapter(id); if (isDeleted == false) { return(BadRequest()); } return(Ok()); }
protected async Task DeleteChapter(Chapter OneChapter) { MessageBoxDialogResult result = await ModalDialog.ShowMessageBoxAsync("Confirm Delete", "Are you sure you want to delete the chapter ?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2); if (result == MessageBoxDialogResult.Yes) { await ChapterService.DeleteChapter(OneChapter.Id); OneQuiz.Chapters.Remove(OneChapter); StateHasChanged(); } }