示例#1
0
        public void AddNewProduct()
        {
            Checker        cheker     = new Checker();
            ProductCreater creater    = new ProductCreater();
            Product        newProduct = new Product(
                creater.InputId(),
                cheker.CheckIsNotEmpty(creater.InputName()),
                cheker.CheckIsNotEmpty(creater.InputCategory()),
                cheker.CheckIsNotEmpty(creater.InputDescription()),
                creater.InputCost()
                );

            ProductsLocalDB.Add(newProduct);
            MenuBacker.BackMessage();
        }
示例#2
0
        public void ChangeProductInformation()
        {
            Checker checker = new Checker();

            Console.WriteLine("Enter the product ID that you want to change");
            string         id      = Console.ReadLine();
            ProductCreater changer = new ProductCreater();

            for (int i = 0; i < ProductsLocalDB.GetProducts.Count; i++)
            {
                if (Convert.ToString(ProductsLocalDB.GetProducts[i].ID) == id)
                {
                    ProductsLocalDB.GetProducts[i].Name        = checker.CheckIsNotEmpty(changer.InputName());
                    ProductsLocalDB.GetProducts[i].Category    = checker.CheckIsNotEmpty(changer.InputCategory());
                    ProductsLocalDB.GetProducts[i].Description = checker.CheckIsNotEmpty(changer.InputDescription());
                    ProductsLocalDB.GetProducts[i].Cost        = changer.InputCost();
                }
                else if (Convert.ToString(ProductsLocalDB.GetProducts[i].ID) != id && i == ProductsLocalDB.GetProducts.Count - 1)
                {
                    Console.WriteLine("There is no product for such ID");
                }
            }
            MenuBacker.BackMessage();
        }