public ActionResult Index(FormCollection fc) { if (fc["btnInsert"] == "Insert") { Product product = new Product() { Name = fc["txtName"], Quantity = int.Parse(fc["txtQuantity"]), SaleMRP = float.Parse(fc["txtSaleMRP"]), IsActive = bool.Parse(fc["txtStatus"]) }; Pc.AddProduct(product); } else if (fc["btnUpdate"] == "Update") { Product product = new Product() { ProductID = int.Parse(fc["txtProductID"]), Name = fc["txtName"], Quantity = int.Parse(fc["txtQuantity"]), SaleMRP = float.Parse(fc["txtSaleMRP"]), IsActive = bool.Parse(fc["txtStatus"]) }; Pc.UpdateProduct(product); } return(RedirectToAction("Index")); }