Пример #1
0
        private Product ReplenishInventory()
        {
            Product newInventory;
            int     newLocationID = 0;

            Console.WriteLine("Enter Location you'd like to update:");
            string userInput        = Console.ReadLine();
            int    productUserInput = 0;

            foreach (StoreLocation l in _repo.GetStoreLocation())
            {
                if (l.Name.Equals(userInput))
                {
                    newLocationID = l.Id;

                    Console.WriteLine("Enter Product ID you'd like to update:");
                    userInput = Console.ReadLine();

                    foreach (Product inv in _repo.GetProduct())
                    {
                        if (inv.Id.Equals(newLocationID) && inv.ProductName.Equals(_repo.GetProductByName(productUserInput).Id))
                        {
                            newInventory = inv;
                            Console.WriteLine("Enter the updated Stock Quantity:");
                            userInput             = Console.ReadLine();
                            newInventory.PieCount = int.Parse(userInput);
                            _repo.UpdateInventory(inv);
                            return(inv);
                        }
                    }
                    Log.Error("Invalid product selection - Manager Menu - Update Inventory");
                    throw new Exception();
                }
            }
            Log.Error("Invalid location selection - Manager Menu - Update Inventory");
            throw new Exception();
        }
Пример #2
0
 public ManagerMenu(IstoreBL repo)
 {
     _repo    = repo;
     product  = _repo.GetProduct();
     location = _repo.GetStoreLocation();
 }