public async Task <IActionResult> DeleteArticle(int id) { var deleted = await _deleteCommand.Execute(id); if (deleted) { return(Ok()); } return(BadRequest("Failed to delete article")); }
public async Task <IActionResult> DeleteArticle(int id) { await _deleteCommand.Execute(id); return(Ok()); // TODO: handle errors //if (await _unitOfWork.Commit()) // return Ok(); //return BadRequest("Failed to delete article"); }
public ActionResult Delete(int id) { try { _deleteArticleCommand.Execute(id); TempData["success"] = "Article deleted."; } catch (EntityNotFoundException e) { TempData["error"] = e.Message; } catch (Exception e) { TempData["error"] = e.Message; } return(RedirectToAction(nameof(Index))); }