public ActionResult Delete(int id) { if (!_catService.CatFactExists(id)) { return(StatusCode(StatusCodes.Status400BadRequest, "The cat could not be found")); } _catService.DeleteCat(id); return(StatusCode(StatusCodes.Status200OK, $"The cat has been deleted.")); }
public IActionResult Delete(int id) { var result = _catService.GetCat(id); if (result == null) { return(NotFound()); } _catService.DeleteCat(id); _fileService.DeleteFile(result.Photo); return(NoContent()); }
public async Task <ActionResult> Delete(int id) { var result = await _catService.GetCat(id); if (result == null) { return(NotFound()); } await _catService.DeleteCat(id); _fileService.DeleteFile(result.Photo); return(NoContent()); }
public async Task <IActionResult> Delete(string id) { if (id == null) { return(NotFound()); } bool isCatDeleted = await catService.DeleteCat(id); if (!isCatDeleted) { return(NotFound()); } return(Redirect("/Cats/All")); }
public ActionResult <Cat> Delete(int id) { return(_catService.DeleteCat(id)); }