Skip to content

Instantly share code, notes, and snippets.

@oclockvn
Created April 12, 2015 05:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oclockvn/fb3536d8225fd955cde7 to your computer and use it in GitHub Desktop.
Save oclockvn/fb3536d8225fd955cde7 to your computer and use it in GitHub Desktop.
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Add(Item item)
{
if (!ModelState.IsValid)
return RedirectToAction("Index");
_db.Items.Add(item);
_db.SaveChanges();
return RedirectToAction("Index");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment