예제 #1
0
        public static List <SelectListItem> GetSizes()
        {
            var sizeSelectList = new List <SelectListItem>();

            List <PizzaSizeDTO> sizes = ApiAccess.getItemsFromApi <List <PizzaSizeDTO> >("sizes");

            foreach (PizzaSizeDTO sz in sizes)
            {
                SelectListItem selectItem = new SelectListItem()
                {
                    Text = sz.Name, Value = sz.Name
                };


                sizeSelectList.Add(selectItem);
            }

            return(sizeSelectList);
        }
예제 #2
0
        public static List <SelectListItem> GetVegetableToppings()
        {
            var vegetableToppingSelectList = new List <SelectListItem>();

            List <ToppingDTO> vegetableToppings = ApiAccess.getItemsFromApi <List <ToppingDTO> >("vegetabletoppings");


            foreach (ToppingDTO tp in vegetableToppings)
            {
                SelectListItem selectItem = new SelectListItem()
                {
                    Text = tp.Name, Value = tp.Name
                };


                vegetableToppingSelectList.Add(selectItem);
            }

            return(vegetableToppingSelectList);
        }
예제 #3
0
        public static List <SelectListItem> GetCheeses()
        {
            var cheeseSelectList = new List <SelectListItem>();

            List <CheeseTypeDTO> cheeses = ApiAccess.getItemsFromApi <List <CheeseTypeDTO> >("cheeses");


            foreach (CheeseTypeDTO ch in cheeses)
            {
                SelectListItem selectItem = new SelectListItem()
                {
                    Text = ch.Name, Value = ch.Name
                };


                cheeseSelectList.Add(selectItem);
            }

            return(cheeseSelectList);
        }
예제 #4
0
        public static List <SelectListItem> GetSauces()
        {
            var sauceSelectList = new List <SelectListItem>();

            List <SauceTypeDTO> sauces = ApiAccess.getItemsFromApi <List <SauceTypeDTO> >("sauces");


            foreach (SauceTypeDTO s in sauces)
            {
                SelectListItem selectItem = new SelectListItem()
                {
                    Text = s.Name, Value = s.Name
                };


                sauceSelectList.Add(selectItem);
            }

            return(sauceSelectList);
        }
예제 #5
0
        public static List <SelectListItem> GetCrusts()
        {
            var crustSelectList = new List <SelectListItem>();

            List <CrustTypeDTO> crusts = ApiAccess.getItemsFromApi <List <CrustTypeDTO> >("crusts");


            foreach (CrustTypeDTO c in crusts)
            {
                SelectListItem selectItem = new SelectListItem()
                {
                    Text = c.Name, Value = c.Name
                };


                crustSelectList.Add(selectItem);
            }

            return(crustSelectList);
        }
예제 #6
0
        public static List <SelectListItem> GetPaymentMethods()
        {
            var paymentMethodsSelectList = new List <SelectListItem>();

            List <PaymentMethodDTO> paymentMethods = ApiAccess.getItemsFromApi <List <PaymentMethodDTO> >("paymentmethods");


            foreach (PaymentMethodDTO pm in paymentMethods)
            {
                SelectListItem selectItem = new SelectListItem()
                {
                    Text = pm.Name, Value = pm.Name
                };


                paymentMethodsSelectList.Add(selectItem);
            }

            return(paymentMethodsSelectList);
        }
예제 #7
0
        public static List <SelectListItem> GetToppingPlacements()
        {
            var toppingPlacementsSelectList = new List <SelectListItem>();

            List <ToppingPlacementDTO> toppingPlacements = ApiAccess.getItemsFromApi <List <ToppingPlacementDTO> >("toppingplacements");


            foreach (ToppingPlacementDTO tpl in toppingPlacements)
            {
                SelectListItem selectItem = new SelectListItem()
                {
                    Text = tpl.Type, Value = tpl.Type
                };


                toppingPlacementsSelectList.Add(selectItem);
            }

            return(toppingPlacementsSelectList);
        }
예제 #8
0
        public static List <SelectListItem> GetAdditionalCheeseToppings()
        {
            var additionalCheeseToppingSelectList = new List <SelectListItem>();

            List <ToppingDTO> additionalCheeseToppings = ApiAccess.getItemsFromApi <List <ToppingDTO> >("additionalcheesetoppings");


            foreach (ToppingDTO tp in additionalCheeseToppings)
            {
                SelectListItem selectItem = new SelectListItem()
                {
                    Text = tp.Name, Value = tp.Name
                };


                additionalCheeseToppingSelectList.Add(selectItem);
            }

            return(additionalCheeseToppingSelectList);
        }
예제 #9
0
        public static List <SelectListItem> GetMeatToppings()
        {
            var meatToppingSelectList = new List <SelectListItem>();

            List <ToppingDTO> meatToppings = ApiAccess.getItemsFromApi <List <ToppingDTO> >("meattoppings");


            foreach (ToppingDTO tp in meatToppings)
            {
                SelectListItem selectItem = new SelectListItem()
                {
                    Text = tp.Name, Value = tp.Name
                };


                meatToppingSelectList.Add(selectItem);
            }

            return(meatToppingSelectList);
        }
예제 #10
0
        public static OrderReceipt GetPendingOrderReceipt(PizzaOrder pendingOrder)
        {
            OrderReceipt pendingReceipt = new OrderReceipt();

            List <PizzaSizeDTO> sizes = ApiAccess.getItemsFromApi <List <PizzaSizeDTO> >("sizes");
            var     matchingSizes     = sizes.Where(x => x.Name == pendingOrder.size);
            decimal sizePrice         = matchingSizes.First().Price;

            List <CrustTypeDTO> crusts = ApiAccess.getItemsFromApi <List <CrustTypeDTO> >("crusts");
            var     matchingCrusts     = crusts.Where(x => x.Name == pendingOrder.crust);
            decimal crustPrice         = matchingCrusts.First().Price;

            List <SauceTypeDTO> sauces = ApiAccess.getItemsFromApi <List <SauceTypeDTO> > ("sauces");
            var     matchingSauces     = sauces.Where(x => x.Name == pendingOrder.sauce);
            decimal saucePrice         = matchingSauces.First().Price;

            List <CheeseTypeDTO> cheeses = ApiAccess.getItemsFromApi <List <CheeseTypeDTO> >("cheeses");
            var     matchingCheeses      = cheeses.Where(x => x.Name == pendingOrder.cheese);
            decimal cheesePrice          = matchingCheeses.First().Price;

            decimal           toppingTotalPrice = 0;
            string            toppingString     = "";
            List <ToppingDTO> vegetableToppings = ApiAccess.getItemsFromApi <List <ToppingDTO> >("vegetabletoppings");

            var matchingVegetableToppings = vegetableToppings.Where(x => x.Name == pendingOrder.vegetableToppings);

            toppingTotalPrice = toppingTotalPrice + matchingVegetableToppings.First().Price;
            toppingString     = toppingString + " " + pendingOrder.vegetableToppings;

            List <ToppingDTO> meatToppings = ApiAccess.getItemsFromApi <List <ToppingDTO> >("meattoppings");

            var matchingMeatToppings = meatToppings.Where(x => x.Name == pendingOrder.meatToppings);

            toppingTotalPrice = toppingTotalPrice + matchingMeatToppings.First().Price;
            toppingString     = toppingString + " " + pendingOrder.meatToppings;

            List <ToppingDTO> additionalCheeseToppings = ApiAccess.getItemsFromApi <List <ToppingDTO> >("additionalcheesetoppings");


            var matchingAdditionalCheeseToppings = additionalCheeseToppings.Where(x => x.Name == pendingOrder.additionalCheeseToppings);

            toppingTotalPrice = toppingTotalPrice + matchingAdditionalCheeseToppings.First().Price;
            toppingString     = toppingString + " " + pendingOrder.additionalCheeseToppings;

            pendingReceipt.cheese          = pendingOrder.cheese;
            pendingReceipt.size            = pendingOrder.size;
            pendingReceipt.sauce           = pendingOrder.sauce;
            pendingReceipt.crust           = pendingOrder.crust;
            pendingReceipt.deliveryAddress = (pendingOrder.addressStreet + " " + pendingOrder.addressCity + " " + pendingOrder.addressState + " " + pendingOrder.addressZip);
            pendingReceipt.paymentType     = pendingOrder.paymentMethod;

            decimal subTotalAmt = (sizePrice + cheesePrice + saucePrice + crustPrice + toppingTotalPrice);

            pendingReceipt.subtotal = subTotalAmt.ToString();

            pendingReceipt.taxes = (1).ToString();

            decimal totalAmt = (sizePrice + cheesePrice + saucePrice + crustPrice + toppingTotalPrice) + 1;

            pendingReceipt.total = totalAmt.ToString();

            pendingReceipt.toppings = toppingString;
            return(pendingReceipt);
        }