Example #1
0
 public ActionResult Post([FromBody] CityDTO value)
 {
     try
     {
         _addCityCommand.Execute(value);
         return(StatusCode(201, "City successfuly inserted"));
     }
     catch (DataAlreadyExistsException)
     {
         return(Conflict("City with that name already exists"));
     }
     catch (Exception)
     {
         return(StatusCode(500, "Server is busy at the moment, please try later"));
     }
 }
 public IActionResult Post([FromBody] CityDto value)
 {
     try
     {
         _addCityCommand.Execute(value);
         return(StatusCode(201));
     }
     catch (EntityAlreadyExistsException e)
     {
         return(Conflict(e.Message));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }