Exemplo n.º 1
0
 public ActionResult Delete(string id)
 {
     try
     {
         deleteTopicCommand.Execute(new Identity(id));
     }
     catch (Exception e)
     {
         ModelState.AddModelError(Guid.NewGuid().ToString(), e);
     }
     return(RedirectToAction("Index"));
 }
Exemplo n.º 2
0
 public ActionResult Delete(int id, TopicDto dto)
 {
     try
     {
         _deleteCommand.Execute(id);
         return(RedirectToAction(nameof(Index)));
     }
     catch (EntityDeleted)
     {
         TempData["error"] = "This Topic is already deleted";
         return(View());
     }
     catch (Exception)
     {
         return(View());
     }
 }
Exemplo n.º 3
0
 public IActionResult Delete(int id)
 {
     try
     {
         _deleteCommand.Execute(id);
         return(NoContent());
     }
     catch (EntityNotFoundException)
     {
         return(NotFound());
     }
     catch (EntityDeleted)
     {
         return(StatusCode(410, "The Topic is already Deleted"));
     }
     catch (Exception)
     {
         return(StatusCode(500, "An error occured"));
     }
 }
Exemplo n.º 4
0
 public HttpResponseMessage Delete(Identity id)
 {
     return(ProcessDelete(() => deleteGroupCommand.Execute(id.ToModel())));
 }