public async Task <IActionResult> Delete(int id) { var deleteBook = await _book.Delete(id); if (deleteBook) { return(RedirectToAction("Index")); } return(View()); }
public async Task <IActionResult> Delete(int id) { var deleteBook = await _book.Delete(id); if (deleteBook) { Alert("Book deleted successfully.", NotificationType.success); return(RedirectToAction("Index")); } Alert("Book not deleted!", NotificationType.error); return(View()); }
public async Task <IActionResult> Delete(int id) { var deleteBook = await _book.Delete(id); if (deleteBook) { return(Ok("Book Deleted")); } else { return(BadRequest(new { message = "Unable to delete Book details" })); } }
public IHttpActionResult Delete(int Id) { try { Book _book = _bookRepository.GetBook(Id); if (_book == null) { return(NotFound()); } _bookRepository.Delete(Id); _bookRepository.Save(); return(Ok("Record Deleted")); } catch (Exception) { return(BadRequest("Record can not be deleted")); } }
public IActionResult Delete(Guid id) { try { if (id == null) { return(StatusCode(400, $"ID is not valid.")); } else { _book.Delete(id); return(StatusCode(204, "No Content")); } } catch (Exception ex) { //_logger.LogCritical($"Exception while get list of items.", ex); return(StatusCode(500, $"Exception while get list of items. {ex.Message}")); } }
// DELETE api/<controller>/5 public bool Delete(int id) { return(repositorydb.Delete(id)); }
public IActionResult DeleteConfirmed(int id) { _book.Delete(id); _loan.DeleteWithBookId(id); return(RedirectToAction(nameof(Index))); }