public OrderProductAddressProductionDateViewModel(OrderProductAddressProductionDate orderProductAddressProductionDate)
        {
            OrderProductAddress = new OrderProductAddressViewModel(orderProductAddressProductionDate.OrderProductAddress);
            ProductionDate      = orderProductAddressProductionDate.ProductionDate;

            OrderProductAddressProductionDateSizes = new List <OrderProductAddressProductionDateSizeViewModel>();
        }
示例#2
0
        public OrderProductAddressDeliveryViewModel(OrderProductAddressDelivery orderProductAddressDelivery)
        {
            OrderProductAddress = new OrderProductAddressViewModel(orderProductAddressDelivery.OrderProductAddress);
            DeliveryId          = orderProductAddressDelivery.DeliveryId;
            DeliveryDate        = orderProductAddressDelivery.DeliveryDate;
            DeliveryImagePath   = orderProductAddressDelivery.DeliveryImagePath;
            AcceptanceId        = orderProductAddressDelivery.AcceptanceId;
            AcceptanceDate      = orderProductAddressDelivery.AcceptanceDate;
            AcceptanceImagePath = orderProductAddressDelivery.AcceptanceImagePath;

            OrderProductAddressDeliverySizes = new List <OrderProductAddressDeliverySizeViewModel>();
        }
示例#3
0
 public OrderProductAddressSizeViewModel(OrderProductAddressSize orderProductAddressSize)
 {
     OrderProductAddress = new OrderProductAddressViewModel(orderProductAddressSize.OrderProductAddress);
     Size     = new SizeViewModel(orderProductAddressSize.Size);
     Quantity = orderProductAddressSize.Quantity;
 }
        public async Task <ActionResult> Details(int?orderId, int?productId, int?addressId)
        {
            if (orderId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            if (productId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            if (addressId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            OrderProductAddress orderProductAddress = await context.OrderProductAddresses
                                                      .Include(opa => opa.OrderProduct.Order)
                                                      .Include(opa => opa.OrderProduct.Product)
                                                      .Include(opa => opa.Address)
                                                      .Include(opa => opa.OrderProductAddressSizes)
                                                      .Include(opa => opa.OrderProductAddressSizes.Select(opas => opas.Size))
                                                      .Include(opa => opa.OrderProductAddressProductionDates)
                                                      .Include(opa => opa.OrderProductAddressDeliveries)
                                                      .FirstOrDefaultAsync(opa => opa.OrderId == orderId &&
                                                                           opa.ProductId == productId &&
                                                                           opa.AddressId == addressId);

            if (orderProductAddress == null)
            {
                return(HttpNotFound());
            }

            OrderProductAddressViewModel model = new OrderProductAddressViewModel(orderProductAddress);

            if (orderProductAddress.OrderProductAddressSizes.Any())
            {
                foreach (var orderProductAddressSize in orderProductAddress.OrderProductAddressSizes)
                {
                    model.OrderProductAddressSizes.Add(new OrderProductAddressSizeViewModel(orderProductAddressSize));
                }
            }

            if (orderProductAddress.OrderProductAddressProductionDates.Any())
            {
                foreach (var orderProductAddressProductionDate in orderProductAddress.OrderProductAddressProductionDates)
                {
                    model.OrderProductAddressProductionDates.Add(new OrderProductAddressProductionDateViewModel(orderProductAddressProductionDate));
                }
            }

            if (orderProductAddress.OrderProductAddressDeliveries.Any())
            {
                foreach (var orderProductAddressDelivery in orderProductAddress.OrderProductAddressDeliveries)
                {
                    model.OrderProductAddressDeliveries.Add(new OrderProductAddressDeliveryViewModel(orderProductAddressDelivery));
                }
            }

            return(View(model));
        }