public IHttpActionResult GetNewShipment(string id) { coreModel.Shipment retVal = null; var order = _customerOrderService.GetById(id, coreModel.CustomerOrderResponseGroup.Full); if (order != null) { retVal = new coreModel.Shipment { Currency = order.Currency }; retVal.Number = _uniqueNumberGenerator.GenerateNumber("SH{0:yyMMdd}-{1:D5}"); //Detect not whole shipped items //TODO: LineItem partial shipping var shippedLineItemIds = order.Shipments.SelectMany(x => x.Items).Select(x => x.LineItemId); //TODO Add check for digital products (don't add to shipment) retVal.Items = order.Items.Where(x => !shippedLineItemIds.Contains(x.Id)) .Select(x => new coreModel.ShipmentItem(x)).ToList(); return(Ok(retVal.ToWebModel())); } return(NotFound()); }
public IHttpActionResult GetNewShipment(string id) { coreModel.Shipment retVal = null; var order = _customerOrderService.GetById(id, coreModel.CustomerOrderResponseGroup.Full); if (order != null) { retVal = new coreModel.Shipment { Currency = order.Currency }; retVal.Number = _operationNumberGenerator.GenerateNumber(retVal); //distribute not shipped items var shippedItems = order.Shipments.SelectMany(x => x.Items).ToArray(); retVal.Items = order.Items.Where(x => !shippedItems.Any(y => y.Id == x.Id)).ToList(); return(Ok(retVal.ToWebModel())); } return(NotFound()); }
public IHttpActionResult GetNewShipment(string id) { coreModel.Shipment retVal = null; var order = _customerOrderService.GetById(id, coreModel.CustomerOrderResponseGroup.Full); if (order != null) { retVal = new coreModel.Shipment { Currency = order.Currency }; retVal.Number = _operationNumberGenerator.GenerateNumber(retVal); //distribute not shipped items var shippedItems = order.Shipments.SelectMany(x => x.Items).ToArray(); retVal.Items = order.Items.Where(x => !shippedItems.Any(y => y.Id == x.Id)).ToList(); return Ok(retVal.ToWebModel()); } return NotFound(); }
public IHttpActionResult GetNewShipment(string id) { coreModel.Shipment retVal = null; var order = _customerOrderService.GetById(id, coreModel.CustomerOrderResponseGroup.Full); if (order != null) { retVal = new coreModel.Shipment { Currency = order.Currency }; retVal.Number = _uniqueNumberGenerator.GenerateNumber("SH{0:yyMMdd}-{1:D5}"); //Detect not whole shipped items //TODO: LineItem partial shipping var shippedLineItemIds = order.Shipments.SelectMany(x => x.Items).Select(x=>x.LineItemId); //TODO Add check for digital products (don't add to shipment) retVal.Items = order.Items.Where(x => !shippedLineItemIds.Contains(x.Id)) .Select(x => new coreModel.ShipmentItem(x)).ToList(); return Ok(retVal.ToWebModel()); } return NotFound(); }