예제 #1
0
 public IActionResult Delete(int id)
 {
     try
     {
         deleteMovie.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
             }
         }));
     }
 }
예제 #2
0
 // GET: Movie/Delete/5
 public ActionResult Delete(string id)
 {
     try
     {
         _deleteMovie.Execute(id);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(RedirectToAction(nameof(Index)));
     }
 }
예제 #3
0
 public IActionResult Delete(string id)
 {
     try
     {
         _deleteMovie.Execute(id);
         return(NoContent());
     }
     catch (EntityNotFoundException)
     {
         return(NotFound());
     }
     catch
     {
         return(StatusCode(500));
     }
 }
예제 #4
0
 public IActionResult Delete(int id)
 {
     try
     {
         deleteMovie.Execute(id);
         return(NoContent());
     }
     catch (EntityNotFoundException e)
     {
         return(UnprocessableEntity(e.Message));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
예제 #5
0
        public ActionResult Delete(int id, MovieDTO collection)
        {
            try
            {
                deleteMovie.Execute(id);

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