public async Task <IActionResult> Delete([FromBody] DeleteBookBindingModel model) { var pictureUrl = await this.booksService.GetPictureUrlByIdAsync(model.Id); if (pictureUrl == null) { return(this.BadRequest(WebConstants.DeleteDownloadPictureEror)); } var result = FileHelpers.Delete($"{this.RootPath}{pictureUrl}"); if (!result) { return(this.BadRequest(WebConstants.DeleteDownloadPictureEror)); } result = await this.booksService.DeleteAsync(model.Id); return(this.Json(new { success = result })); }
public async Task <ActionResult> Delete(DeleteBookBindingModel model) { var result = await _bookService.DeleteAsync(model.ID); return(Json(result, JsonRequestBehavior.AllowGet)); }