示例#1
0
 public IActionResult PostShipment([FromBody] ShipmentModel model)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         else if (_shipmentsService.IsInvoiceExisted(model.InvoiceNumber))
         {
             return(BadRequest("Duplicate Invoice"));
         }
         //else if(!_shipmentsService.IsShipmentAllowed(model.Lines, out string message))
         //{
         //    return BadRequest(message);
         //}
         else
         {
             bool res = _shipmentsService.PostShipment(model);
             if (res)
             {
                 return(Ok());
             }
             return(BadRequest("Shipment Creation failed."));
         }
     }
     catch (Exception ex)
     {
         throw new AppException(ex);
     }
 }