Created
June 14, 2012 18:49
-
-
Save gprasant/2932155 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ViewResult Save(Model modelToSave) | |
{ | |
if(ModelState.isValid) | |
{ | |
modelToSave.Save(); | |
TempData["Message"] = "Saved Successfully"; | |
// redirects to the list action if the save is successful | |
return RedirectToAction("Index"); | |
} | |
//if there are any errors, the same edit View is returned. | |
return View("Edit", modelToSave); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment