public override OrderDisplayItem PopulateOrderDisplayItem() { OrderDisplayItem displayItem = base.PopulateOrderDisplayItem(); var toppingsString = new StringBuilder(); for (int i = 0; i < Toppings.CurrentToppings.Count; i++) { if (SizeOfSalad == SaladSize.LunchSpecial) { toppingsString.Append(" "); } if (i == 0) { toppingsString.Append(" "); } else { toppingsString.Append("\n "); } toppingsString.Append(Toppings.CurrentToppings[i].ToppingDisplayName); } if (toppingsString.Length != 0) { displayItem.Toppings = toppingsString.ToString(); displayItem.HasToppings = true; } return(displayItem); }
public OrderDisplay RetrieveOrderDisplay(int orderID) { OrderDisplay orderDisplay = new OrderDisplay(); //Code that retrieves the defined order field.. //Creare the instance of the Order class; //Pass in the request ID; Order order = new Order(orderID); //Temporary Hard - coded data in order to make Tests if (orderID == 10) { orderDisplay.FirstName = "Rich"; orderDisplay.LastName = "Strong"; orderDisplay.OrderDate = new DateTimeOffset(2015,4,12,9,00,00, new TimeSpan()); orderDisplay.ShippingAddress = new Address() { AddressType = 1, StreetLineOne = "Good Year", StreetLineTwo = "Good Harvest", City = "Brighton", State = "Central UK", Country = "bRIGHTON Area", PostCode = "144UK" }; } orderDisplay.OrderDisplayItemsList = new List<OrderDisplayItem>(); // Code that retrives the order items // Hardcode data.... if (orderID == 10) { var orderDisplayItem = new OrderDisplayItem() { ProductName = "Beef meat", PurchasePrice = 8M, OrderQuantity = 1 }; orderDisplay.OrderDisplayItemsList.Add(orderDisplayItem); orderDisplayItem = new OrderDisplayItem() { ProductName = "Sheep meat", PurchasePrice = 12M, OrderQuantity = 2 }; orderDisplay.OrderDisplayItemsList.Add(orderDisplayItem); } return orderDisplay; }
public OrderDisplay RetreiveOrderDisplay(int orderId) { OrderDisplay orderDisplay = new OrderDisplay(); if (orderId == 10) { orderDisplay.FirstName = "xxx"; orderDisplay.LastName = "xxx"; orderDisplay.OrderDate = new DateTimeOffset(); orderDisplay.ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "xxx", StreetLine2 = "xxx", City = "xxx", StateProvince = "xxx", Country = "xxx", PostCode = "xxx" }; } orderDisplay.orderDisplayItemList = new List<OrderDisplayItem>(); if (orderId == 10) { var orderDisplayItem = new OrderDisplayItem() { ProductName = "xxx", PurchasePrice = 15.9M, OrderQuantitiy = 1 }; orderDisplay.orderDisplayItemList.Add(orderDisplayItem); orderDisplayItem = new OrderDisplayItem() { ProductName = "xxx", PurchasePrice = 6M, OrderQuantitiy = 1 }; orderDisplay.orderDisplayItemList.Add(orderDisplayItem); } return orderDisplay; }
public OrderDisplay RetrieveOrderDisplay(int orderId) { OrderDisplay orderDisplay = new OrderDisplay(); if (orderId == 10) { orderDisplay.FirstName = "Bilbo"; orderDisplay.LastName = "Baggins"; orderDisplay.OrderDate = new DateTimeOffset(2014, 4, 14, 10, 0, 0, new TimeSpan(7, 0, 0)); orderDisplay.ShippingAddress = new Address() { StreetLine1 = "Bag End", StreetLine2 = "Bagshot row", City = "Hobbiton", State = "Shire", Country = "Middle Earth", PostalCode = "144" }; } orderDisplay.OrderDisplayItemList = new List <OrderDisplayItem>(); 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); }
public OrderDisplay RetrieveOrderDisplay(int orderId) { OrderDisplay orderDisplay = new OrderDisplay(); var addressRepository = new AddressRepository(); if (orderId == 10) { orderDisplay.FirstName = "Steve"; orderDisplay.LastName = "Jobs"; orderDisplay.OrderDate = new DateTimeOffset(2018, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0)); orderDisplay.ShippingAddress = addressRepository.Retrieve(1); } orderDisplay.OrderDisplayItemList = new List <OrderDisplayItem>(); 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); }