Exemple #1
0
        public async Task <IActionResult> GetSizes()
        {
            List <Size> sizes = await _repo.GetSizes();

            // HTTP 200 response Ok
            return(Ok(sizes));
        }
Exemple #2
0
        private decimal CalculateTotalCost(int?size, int?crust)
        {
            var sizeCost  = _sizeRepo.GetSizes(size).FirstOrDefault().SizeCost;
            var crustCost = _crustRepo.GetCrustTypes(crust).FirstOrDefault().CrustCost;

            return(sizeCost + crustCost);
        }
Exemple #3
0
        public void ViewUserOrderHistory()
        {
            if (orderRepo != null)
            {
                foreach (var order in orderRepo.GetOrders(userId: currentUser.UserId))
                {
                    var storeId = order.StoreId ?? default(int);

                    foreach (var pizza in pizzaSoldRepo.GetPizzasSold(orderId: order.OrderId))
                    {
                        var pizzaSize  = pizza.PizzaSize ?? default(int);
                        var pizzaCrust = pizza.PizzaCrust ?? default(int);

                        Console.WriteLine($"{order.OrderId}: {sizeRepo.GetSizes(pizzaSize).First().SizeName}" +
                                          $" {pizza.PizzaName} " +
                                          $"with {crustRepo.GetCrustTypes(pizzaCrust).First().CrustName} crust - ${pizza.TotalCost} ");
                    }

                    Console.WriteLine($"{storeRepo.GetStores(storeId).First().StoreLocation} - {order.OrderTimestamp}");
                }
            }
            else
            {
                throw new NullReferenceException("ERROR: Order history not found");
            }
        }
Exemple #4
0
        public IActionResult Index(long id)
        {
            ViewBag.SelectedStore = id;
            OrderViewModel orderViewModel = new OrderViewModel()
            {
                orders   = _orderRepository.GetOrdersByStore(id),
                crusts   = _crustRepository.GetCrusts(),
                sizes    = _sizeRepository.GetSizes(),
                toppings = _toppingsRepository.GetToppings()
            };

            return(View("order", orderViewModel));
        }