public IActionResult Delete(int id) { try { _rep.Delete(id); _rep.UnitOfWork.SaveChanges(); return(Ok(ApiResponse.Ok(id))); } catch (Exception e) { return(BadRequest(ApiResponse.Error(id, e.Message))); } }
public IActionResult Delete(int authorId) { var authorToDelete = _authorsRepository.GetById(authorId); if (authorToDelete == null) { return(NotFound()); } _authorsRepository.Delete(authorId); return(new NoContentResult()); }
public async Task DeleteAndSave(string Id) { _authorRepo.Delete(Id); await _authorRepo.Save(); }
// DELETE: api/Authors/5 public void Delete(int id) { authorsRepository.Delete(id); }
public void Delete(string id) { var author = GetAuthorById(id); authorsRepository.Delete(author); }
public int Delete(int id) { return(_authorsRepository.Delete(id)); }
public async Task <IActionResult> Delete(string id) { await authorsRepository.Delete(id); return(Ok("Author deleted")); }
// DELETE: api/authors/5 public HttpResponseMessage Delete(int id) { bool deleted = _authorsRepository.Delete(id); return(Request.CreateResponse <bool>(HttpStatusCode.OK, deleted)); }