Esempio n. 1
0
 public IActionResult Delete(int id)
 {
     try
     {
         _deleteModelCommand.Execute(id);
         return(StatusCode(204));
     }
     catch (EntityNotFoundException)
     {
         return(NotFound());
     }
 }
Esempio n. 2
0
 public ActionResult Delete(int id, IFormCollection collection)
 {
     try
     {
         // TODO: Add delete logic here
         _deleteModel.Execute(id);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
Esempio n. 3
0
 public ActionResult Delete(int id)
 {
     try
     {
         _delete.Execute(id);
         return(StatusCode(204));
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(StatusCode(500));
     }
 }
Esempio n. 4
0
        public IActionResult Delete(int id)
        {
            try
            {
                _deleteModelCommand.Execute(id);
                return(NoContent());
            }
            catch (EntityNotFoundException e)
            {
                if (e.Message == "Model doesn't exist.")
                {
                    return(NotFound(e.Message));
                }

                return(UnprocessableEntity(e.Message));
            }
        }