public ActionResult Edit(MainMenu menu) { if (ModelState.IsValid) { if (string.IsNullOrEmpty(menu.MainMenuText)) { ModelState.AddModelError("Error", "Please Enter Main Menu Text"); return(View("Edit")); } int value = IObjMainMenu.UpdateMainMenuByID(menu); if (value > 0) { TempData["Message"] = "Record Updated Successfully"; } else { TempData["Message"] = "Something Went Wrong"; } } else { ModelState.AddModelError("Error", "Please Enter All Fiields"); } return(View("Edit")); }