Exemplo n.º 1
0
        public static OrderDetail FromOrderDetailDTO(OrderDetailDTO o, int orderId)
        {
            SklepKortowiadaWMiIContext db = new SklepKortowiadaWMiIContext();

            return(new OrderDetail()
            {
                Quantity = o.Quantity,
                Number = o.Number,
                ProductId = o.ProductId,
                OrderId = orderId,
                Id = o.Id
            });
        }
Exemplo n.º 2
0
        public static OrderDTO ToOrderDTO(Order o)
        {
            SklepKortowiadaWMiIContext db           = new SklepKortowiadaWMiIContext();
            List <OrderDetailDTO>      orderDetails = db.OrderDetails.AsEnumerable <OrderDetail>().Select(p => OrderDetailDTO.ToOrderDetailDTO(p)).Where(p => p.OrderId == o.Id).AsEnumerable <OrderDetailDTO>().ToList();

            return(new OrderDTO()
            {
                Id = o.Id,
                Barcode = o.Barcode,
                Details = orderDetails,
                Faculty = o.Faculty,
                Mode = o.Mode,
                Name = o.Name,
                Paid = o.Paid,
                Received = o.Received,
                SecondName = o.SecondName,
                StudentNumber = o.StudentNumber
            });
        }