Example #1
0
 public IActionResult Delete(int id)
 {
     try
     {
         deleteActor.Execute(id);
         return(StatusCode(204));
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(new
         {
             Errors = new List <string> {
                 e.Message
             }
         }));
     }
     catch (Exception e)
     {
         return(StatusCode(500, new
         {
             Errors = new List <string> {
                 e.Message
             }
         }));
     }
 }
Example #2
0
 public ActionResult Delete(int id)
 {
     try
     {
         deleteActorCommand.Execute(id);
         return(NoContent());
     }
     catch (DataNotFoundException)
     {
         return(NotFound());
     }
     catch (Exception)
     {
         return(StatusCode(500));
     }
 }
 public IActionResult Delete(int id)
 {
     try
     {
         deleteActor.Execute(id);
         return(NoContent());
     }
     catch (EntityNotFoundException e)
     {
         return(UnprocessableEntity(e.Message));
     }
     catch (Exception e)
     {
         return(StatusCode(500));
     }
 }
        public ActionResult Delete(int id, ActorDTO collection)
        {
            try
            {
                deleteActor.Execute(id);

                return(RedirectToAction(nameof(Index)));
            }
            catch (EntityNotFoundException e)
            {
                TempData["error"] = e.Message;
            }
            catch (Exception e)
            {
                TempData["error"] = e.Message;
            }
            return(View());
        }