Пример #1
0
 public IActionResult Post([FromBody] ActorDto dto)
 {
     try
     {
         addActors.Execute(dto);
         return(StatusCode(201));
     }
     catch (EntityAlreadyExistsException e)
     {
         return(StatusCode(409, new
         {
             Errors = new List <string> {
                 e.Message
             }
         }));
     }
     catch (Exception e)
     {
         return(StatusCode(500, new
         {
             Errors = new List <string> {
                 e.Message
             }
         }));
     }
 }
Пример #2
0
 public ActionResult Post([FromBody] ActorDTO value)
 {
     try
     {
         addActorCommand.Execute(value);
         return(StatusCode(201));
     }
     catch (DataAlreadyExistsException)
     {
         return(Conflict());
     }
     catch (Exception)
     {
         return(StatusCode(500));
     }
 }