public async Task UpdateShipmentAsync(AShipment_UpdateShipment updateShipment) { using var log = BeginFunction(nameof(ShipmentAdminService), nameof(UpdateShipmentAsync), updateShipment); try { await Assert(SecurityPolicy.AllowEditFulfillment); await FulfillmentMicroService.UpdateShipmentAsync(updateShipment.MUpdateShipment); } catch (Exception ex) { log.Exception(ex); throw; } }
private async Task <long> SaveShipment(EditShipment model) { if (model.ShipmentId == null) { var mCreateShipmentItems = new List <MFulfillment_CreateShipmentItem>(); foreach (var item in model.ShipmentItems) { mCreateShipmentItems.Add(new MFulfillment_CreateShipmentItem() { ShipmentRequestItemId = item.ShipmentRequestItemId, Quantity = item.Quantity }); } var mCreateShipment = new MFulfillment_CreateShipment() { ShipmentDateTimeUtc = Locale.GetUtcFromLocalTime(model.ShipmentDate), ShippingVendorId = model.ShippingVendorId, TrackingCode = model.TrackingNumber, CreateShipmentItems = mCreateShipmentItems }; var aCreateShipment = new AShipment_CreateShipment() { MCreateShipment = mCreateShipment }; var shipmentId = await ShipmentAdminService.CreateShipmentAsync(aCreateShipment); return(shipmentId); } else { var mUpdateShipmentItems = new List <MFulfillment_UpdateShipmentItem>(); foreach (var item in model.ShipmentItems) { mUpdateShipmentItems.Add(new MFulfillment_UpdateShipmentItem() { ShipmentItemId = item.ShipmentItemId.Value, Quantity = item.Quantity }); } var mUpdateShipment = new MFulfillment_UpdateShipment() { ShipmentDateTimeUtc = Locale.GetUtcFromLocalTime(model.ShipmentDate), ShippingVendorId = model.ShippingVendorId, TrackingCode = model.TrackingNumber, UpdateShipmentItems = mUpdateShipmentItems }; var aUpdateShipment = new AShipment_UpdateShipment() { MUpdateShipment = mUpdateShipment }; await ShipmentAdminService.UpdateShipmentAsync(aUpdateShipment); return(model.ShipmentId.Value); } }