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);
        }
        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);
        }
        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);
        }
        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);
        }
        public static List <SelectListItem> GetVegetableToppings()
        {
            var vegetableToppingSelectList = new List <SelectListItem>();

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


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


                vegetableToppingSelectList.Add(selectItem);
            }

            return(vegetableToppingSelectList);
        }
        public static List <SelectListItem> GetCheeses()
        {
            var cheeseSelectList = new List <SelectListItem>();

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


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


                cheeseSelectList.Add(selectItem);
            }

            return(cheeseSelectList);
        }
        public static List <SelectListItem> GetSauces()
        {
            var sauceSelectList = new List <SelectListItem>();

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


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


                sauceSelectList.Add(selectItem);
            }

            return(sauceSelectList);
        }
        public static List <SelectListItem> GetCrusts()
        {
            var crustSelectList = new List <SelectListItem>();

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


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


                crustSelectList.Add(selectItem);
            }

            return(crustSelectList);
        }
Example #9
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);
        }