Esempio n. 1
0
        //store all location and orders instantiating them into an object that will display orders by location
        public OrdersByLocationModel ServOrderHistoryByLocation(string location)
        {
            //storing all location names
            var locations = _repoStoreLocation.GetAllStoreLocations().Select(x => x.Location);
            //storing all orders
            var userOrders = _repoUserOrder.GetAllOrders();

            if (!string.IsNullOrEmpty(location))
            {
                //if user selects a location, get all the order of that location
                userOrders = _repoUserOrder.GetAllOrderByLocation(location);
            }
            //this model helps the view to make a order by location filter
            OrdersByLocationModel order = new OrdersByLocationModel
            {
                //displays all the location in a drop down list
                storeLocations = new SelectList(locations.ToList()),
                //display user order in a list
                userOrders = userOrders.ToList()
            };

            return(order);
        }
Esempio n. 2
0
 //Displays all locations using repoStoreLocation
 public IActionResult Location()
 {
     return(View(_repoStoreLocation.GetAllStoreLocations()));
 }