public ActionResult Edit(int id, [FromBody] PosterDto dto) { try { dto.Id = id; editPoster.Execute(dto); return(RedirectToAction(nameof(Index))); } catch (EntityNotAllowedException) { return(RedirectToAction("PageNotFound", "Redirections")); } catch (EntityAlreadyExistsException e) { TempData["error"] = e.Message; } catch (Exception e) { TempData["error"] = e.Message; } return(RedirectToAction(nameof(Index))); }
public IActionResult Put(int id, [FromBody] PosterDto dto) { try { dto.Id = id; editPoster.Execute(dto); return(StatusCode(204)); } catch (EntityAlreadyExistsException e) { return(StatusCode(409, new { Errors = new List <string> { e.Message } })); } 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 } })); } }