// GET: /<controller>/ public IActionResult Index(int id) { if (id < 0) { return(NotFound()); } var inventory = _storeRepo.GetOrdersByLocationId(id); return(View(inventory)); }
public void GetOrdersByLocation() { Console.WriteLine("To view the order history of a location, enter the Location's Id:"); locationId = Int32.Parse(Console.ReadLine()); var orders = storeRepo.GetOrdersByLocationId(locationId); Console.WriteLine("Here is the inventory for this location"); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Order Id \tFirst Name\tLast Name\tOrdered Product \tQuantity\t\tDate"); foreach (var order in orders) { Console.WriteLine($"{order.OrderId}\t\t{order.Customer.FirstName}\t\t{order.Customer.LastName}\t\t{order.Product.Name}\t\t{order.OrderQuantity}\t\t{order.Date}"); } }