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()); } }
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); //} }