public ActionResult Put(int id, [FromBody] ActorDTO value)
 {
     try
     {
         editActorCommand.Execute(value);
         return(NoContent());
     }
     catch (DataNotFoundException)
     {
         return(NotFound());
     }
     catch (DataNotAlteredException)
     {
         return(Conflict("Data not altered"));
     }
     catch (DataAlreadyExistsException)
     {
         return(Conflict());
     }
     catch (Exception)
     {
         return(StatusCode(500));
     }
 }
Exemple #2
0
 public IActionResult Put(int id, [FromBody] ActorDto dto)
 {
     try
     {
         dto.Id = id;
         editActor.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
             }
         }));
     }
 }