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 == 1) { orderDisplay.FirstName = "Queen"; orderDisplay.LastName = "Swain"; orderDisplay.OrderDate = new DateTimeOffset(2019, 3, 2, 7, 0, 0, TimeSpan.Zero); orderDisplay.ShippingAddress = new Address() { AddressType = 1, City = "BBSR", Country = "India", State = "Odisha", StreetLine1 = "Lane no 8", StreetLine2 = "Shukhmeswar Temple", PostalCode = "751002" }; } orderDisplay.orderDisplayItemList = new List <OrderDisplayItem>(); //code that retrieves order Item if (orderId == 1) { var orderDispalyItem = new OrderDisplayItem() { ProductName = "Tshirt", PurchasePrice = 15.55m, OrderQuantity = 3 }; orderDisplay.orderDisplayItemList.Add(orderDispalyItem); orderDispalyItem = new OrderDisplayItem() { ProductName = "Pant", PurchasePrice = 55.55m, OrderQuantity = 3 }; orderDisplay.orderDisplayItemList.Add(orderDispalyItem); } return(orderDisplay); }