public ShipmentDisplay PutShipment(ShipmentDisplay shipment) { var merchShipment = _shipmentService.GetByKey(shipment.Key); var orderKeys = shipment.Items.Select(x => x.ContainerKey).Distinct(); if (merchShipment == null) throw new NullReferenceException("Shipment not found for key"); merchShipment = shipment.ToShipment(merchShipment); _shipmentService.Save(merchShipment); this.UpdateOrderStatus(orderKeys); return merchShipment.ToShipmentDisplay(); }
public HttpResponseMessage PutShipment(ShipmentDisplay shipment) { var response = Request.CreateResponse(HttpStatusCode.OK); try { var merchShipment = _shipmentService.GetByKey(shipment.Key); if (merchShipment == null) { return Request.CreateResponse(HttpStatusCode.NotFound); } merchShipment = shipment.ToShipment(merchShipment); _shipmentService.Save(merchShipment); } catch (Exception ex) { response = Request.CreateResponse(HttpStatusCode.NotFound, String.Format("{0}", ex.Message)); } return response; }