Beispiel #1
0
 public ActionResult Edit(string id, MovieDto movie)
 {
     try
     {
         movie.Id = id;
         _updateMovie.Execute(movie);
         return(RedirectToAction(nameof(Index)));
     }
     catch (EntityAlreadyExistException)
     {
         TempData["error"] = "Movie with this name already exist!";
         return(View());
     }
     catch (Exception)
     {
         TempData["error"] = "Server error, please try later!";
         return(View());
     }
 }
Beispiel #2
0
 public IActionResult Put(string id, [FromBody] MovieDto obj)
 {
     obj.Id = id;
     try
     {
         _updateMovie.Execute(obj);
         return(NoContent());
     }
     catch (EntityAlreadyExistException)
     {
         return(Conflict());
     }
     catch (EntityNotFoundException)
     {
         return(NotFound());
     }
     //catch
     //{
     //    return StatusCode(500);
     //}
 }