Example #1
0
        public void ChooseLocation(int custId)
        {
            bool stayChooseLocation = true;

            Console.WriteLine("\nChoose a location.");
            do
            {
                //display locations
                int i = 1;
                foreach (var item in _locationBL.GetLocations())
                {
                    Console.WriteLine($"[{item.Id}] {item.Address} {item.City}, {item.State} ({item.Zipcode})");
                    i++;
                }
                Console.WriteLine($"[{i}] Exit");
                Console.WriteLine("Enter a number: ");

                //get user input
                int userInput = int.Parse(Console.ReadLine());

                if (_locationBL.GetLocationById(userInput) != null)
                {
                    ShopInventory(userInput, custId);
                }
                else if (userInput == i)
                {
                    ExitUI();
                }
                else
                {
                    Console.WriteLine("Not part of menu! Please try again.");
                    continue;
                }
            } while (stayChooseLocation);
        }
Example #2
0
        public ActionResult OrderHistory(string email)
        {
            return(View
                   (
                       _customerOrderHistoryBL.GetCustomerOrderHistoryById
                       (
                           _customerBL.GetCustomerByEmail(HttpContext.Session.GetString("UserEmail")).Id
                       ).Select
                       (
                           x => _mapper.cast2OrderHistoryIndexVM
                           (
                               x,
                               _locationBL.GetLocationById(x.LocId),
                               _orderLineItemBL.GetCustomerOrderLineItemById(x.OrderId).Select
                                   (y => _mapper.cast2CartIndexVM(y,
                                                                  _productBL.GetProductById((int)y.ProdId)
                                                                  )).ToList()
                           )
                       ).ToList()

                   ));
        }
Example #3
0
        public void GetCustomerOrderHistory()
        {
            Console.WriteLine($"Order History for {_user.CustomerName}");
            foreach (var item in _customerOrderHistory.GetCustomerOrderHistories())
            {
                if (item.CustId == _user.Id)
                {
                    Console.WriteLine("----------------------------------------------------------------");
                    Console.WriteLine($"{item.ToString()}\t\tLocation: {_locationBL.GetLocationById((int)item.LocId).LocName}");

                    foreach (var orderItem in _customerOrderLineItem.GetCustomerOrderLineItems())
                    {
                        if (item.OrderId == orderItem.OrderId)
                        {
                            Console.WriteLine($"\t{_productBL.GetProductById((int)orderItem.ProdId).ProdName}\n\t\tQuantity: {orderItem.Quantity}");
                        }
                    }
                    Console.WriteLine();
                }
            }

            Console.ReadLine();
        }