Skip to content

Instantly share code, notes, and snippets.

@gprasant
Created June 14, 2012 18:39
Show Gist options
  • Save gprasant/2932060 to your computer and use it in GitHub Desktop.
Save gprasant/2932060 to your computer and use it in GitHub Desktop.
public ViewResult Save(Model modelToSave)
{
if(ModelState.isValid)
{
modelToSave.Save();
// 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