コード例 #1
0
        public OrderDisplay RetrieveOrderDisplay(int orderId)
        {
            var orderDisplay = new OrderDisplay();

            // Code that retrieves the defined order fields

            // Temporary hard coded data
            if (orderId == 10)
            {
                orderDisplay.FirstName       = "Bilbo";
                orderDisplay.LastName        = "Baggins";
                orderDisplay.OrderDate       = new DateTimeOffset(2014, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0));
                orderDisplay.ShippingAddress = new Address()
                {
                    AddressType = 1,
                    StreetLine1 = "Bag End",
                    StreetLine2 = "Bagshot row",
                    City        = "Hobbiton",
                    State       = "Shire",
                    Country     = "Middle Earth",
                    PostalCode  = "144"
                };
            }

            orderDisplay.OrderDisplayItemList = new List <OrderDisplayItem>();

            // Code that retrieves the order items

            // Temporary hard coded data
            if (orderId == 10)
            {
                var orderDisplayItem = new OrderDisplayItem()
                {
                    ProductName   = "Sunflowers",
                    OrderQuntity  = 2,
                    PurchasePrice = 15.96M
                };
                orderDisplay.OrderDisplayItemList.Add(orderDisplayItem);

                orderDisplayItem = new OrderDisplayItem()
                {
                    ProductName   = "Rake",
                    OrderQuntity  = 1,
                    PurchasePrice = 6M
                };
                orderDisplay.OrderDisplayItemList.Add(orderDisplayItem);
            }

            return(orderDisplay);
        }
コード例 #2
0
        public OrderDisplay RetrieveOrderDisplay(int orderId)
        {
            OrderDisplay orderDisplay = new OrderDisplay();

            //this would retrieve code, but we will use hard-coded values
            if (orderId == 10)
            {
                orderDisplay.FirstName       = "Bilbo";
                orderDisplay.LastName        = "Baggins";
                orderDisplay.OrderDate       = new DateTimeOffset(2014, 4, 14, 10, 00, 00, new TimeSpan(0));
                orderDisplay.ShippingAddress = new Address()
                {
                    AddressType = 1,
                    StreetLine1 = "Bag End",
                    StreetLine2 = "Bagshot Row",
                    City        = "Hobbiton",
                    State       = "Shire",
                    Country     = "Middle Earth",
                    PostalCode  = "144"
                };
            }

            orderDisplay.OrderDisplayItemList = new List <OrderDisplayItem>();
            //code that retrives the order items to display
            if (orderId == 10)
            {
                var orderDisplayItem = new OrderDisplayItem()
                {
                    ProductName   = "Sunflowers",
                    PurchasePrice = 15.96M,
                    OrderQuantity = 2
                };
                orderDisplay.OrderDisplayItemList.Add(orderDisplayItem);

                orderDisplayItem = new OrderDisplayItem()
                {
                    ProductName   = "Rake",
                    PurchasePrice = 6M,
                    OrderQuantity = 1
                };
                orderDisplay.OrderDisplayItemList.Add(orderDisplayItem);
            }

            return(orderDisplay);
        }
コード例 #3
0
        public OrderDisplay RetrieveOrderDisplay(int orderId)
        {
            OrderDisplay orderDisplay = new OrderDisplay();

            // Code that retrieves the defined order fields
            var addressRepository = new AddressRepository();

            // Temporary Hard-coded data
            if (orderId == 10)
            {
                orderDisplay.FirstName       = "Bilbo";
                orderDisplay.LastName        = "Baggins";
                orderDisplay.OrderDate       = new DateTimeOffset(2014, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0));
                orderDisplay.ShippingAddress = addressRepository.Retrieve(1);
            }

            orderDisplay.OrderDisplayItemList = new List <OrderDisplayItem>();

            // Code that retrieves the order items

            // Temporary Hard-coded data
            if (orderId == 10)
            {
                var orderDisplayItem = new OrderDisplayItem()
                {
                    ProductName   = "Sunflowers",
                    PurchasePrice = 15.96M,
                    OrderQuantity = 2
                };
                orderDisplay.OrderDisplayItemList.Add(orderDisplayItem);

                orderDisplayItem = new OrderDisplayItem()
                {
                    ProductName   = "Rake",
                    PurchasePrice = 6M,
                    OrderQuantity = 1
                };
                orderDisplay.OrderDisplayItemList.Add(orderDisplayItem);
            }


            return(orderDisplay);
        }