//validating
        public ActionResult AddProduct(string name, string catid, string supid, string price)
        {
            CheckProductValues check = null;

            if (name == "" || catid == "" || supid == "" || price == "")
            {
                AddProductForm(name, catid, supid, price);
                string readErrors = check.Save();
                ViewBag.ReadErrors = readErrors;
                return(View("AddProductForm"));
            }
            else
            {
                if (name.Length > 20 || catid.Length > 4 || supid.Length > 4 || price.Length > 4)
                {
                    check = new CheckProductValues(name, catid, supid, price);
                    AddProductForm(name, catid, supid, price);
                    string readErrors = check.Save();
                    ViewBag.ReadErrors = readErrors;
                    errors.ReadErrors(check.Save());
                    return(View("AddProductForm"));
                }
                else
                {
                    products = new NewProducts(new InsertProducts());
                    products.PerformInsertOperation(name, catid, supid, price);
                    check = new CheckProductValues(name, catid, supid, price);
                    errors.ReadErrors(check.Save());
                    return(RedirectToAction("ProductList"));
                }
            }
        }
        //executing query and redirecting back to view
        public ActionResult UpdateProduct(int id, string name, string catid, string supid, string price)
        {
            CheckProductValues check = null;

            if (name.Length > 20 || catid.Length > 4 || supid.Length > 4 || price.Length > 4)
            {
                check = new CheckProductValues(name, catid, supid, price);
                string readErrors = check.Save();
                ViewBag.ReadErrors = readErrors;
                errors.ReadErrors(check.Save());
                return(View("Errors"));
            }
            else
            {
                products = new NewProducts(new UpdateProducts());
                products.PerformUpdateOperation(id, name, catid, supid, price);
                check = new CheckProductValues(name, catid, supid, price);
                errors.ReadErrors(check.Save());
                return(RedirectToAction("ProductList"));
            }
        }