Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public async Task<ShipmentFormModel> GetShipmentForEditAsync(int shipmentId)
- {
- Shipment shipment = await this.shipmentRepo.All()
- .Include(x => x.Sender)
- .Include(x => x.Receiver)
- .FirstOrDefaultAsync(x => x.Id == shipmentId);
- if (shipment == null)
- {
- throw new NullReferenceException(ShipmentNotExist);
- }
- ShipmentFormModel model = new ShipmentFormModel()
- {
- Id = shipment.Id,
- TrackingNumber = shipment.TrackingNumber,
- SenderFirstName = shipment.Sender.FirstName,
- SenderLastName = shipment.Sender.LastName,
- SenderPhoneNumber = shipment.Sender.PhoneNumber,
- ReceiverFirstName = shipment.Receiver.FirstName,
- ReceiverLastName = shipment.Receiver.LastName,
- ReceiverPhoneNumber = shipment.Receiver.PhoneNumber,
- PickUpAddress = shipment.PickupAddress,
- PickUpTown = shipment.PickUpTown,
- PickUpCountry = shipment.PickUpCountry,
- DestinationAddress = shipment.DestinationAddress,
- DestinationTown = shipment.DestinationTown,
- DestinationCountry = shipment.DestinationCountry,
- Weight = shipment.Weight,
- DeliveryWay = shipment.DeliveryWay,
- DeliveryType = shipment.DeliveryType,
- ProductType = shipment.ProductType,
- Price = shipment.Price,
- };
- return model;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement