Ejemplo n.º 1
0
 public IActionResult Post([FromBody][SwaggerRequestBody("Amendment to add to CRM", Required = true)]
                           Amendment amendment,
                           [FromRoute][SwaggerParameter("The checking window to request amendments from", Required = false)]
                           CheckingWindow checkingWindow)
 {
     try
     {
         var outcome = _amendmentService.AddAmendment(amendment);
         return(Ok(new GetResponse <AmendmentOutcome>
         {
             Result = outcome,
             Error = new Error()
         }));
     }
     catch (NotAllowedException ne)
     {
         var response = new GetResponse <string>
         {
             Result = ne.Detail,
             Error  = new Error
             {
                 ErrorMessage = ne.Title
             }
         };
         return(BadRequest(response));
     }
     catch (Exception e)
     {
         var response = new GetResponse <string>
         {
             Result = string.Empty,
             Error  = new Error
             {
                 ErrorMessage = e.Message
             }
         };
         return(BadRequest(response));
     }
 }