public ActionResult StateForm(FormCollection fc) { if (fc["btnInsert"] == "Insert") { State state = new State() { State1 = fc["txtState"], CountryID = int.Parse(fc["txtCountry"]) }; Bc.AddState(state); } else if (fc["btnUpdate"] == "Update") { State state = new State() { StateID = int.Parse(fc["txtStateID"]), State1 = fc["txtState"], CountryID = int.Parse(fc["txtCountry"]) }; Bc.UpdateState(state); } return(RedirectToAction("StateForm")); }