日期:2014-05-17 浏览次数:20807 次
[HttpPost]
public ActionResult Create(Movie newMovie)
{
MovieDBContext db = new MovieDBContext();
if (ModelState.IsValid)
{
db.Movies.Add(newMovie);
db.SaveChanges();
return RedirectToAction("Index");
}
else
return View(newMovie);
}
[HttpPost]
public ActionResult Create(Movie newMovie)
{
using (MovieDBContext db = new MovieDBContext())
{
if (ModelState.IsValid)
{
db.Movies.Add(newMovie);
db.SaveChanges();
return RedirectToAction("Index");
}
else
return View(newMovie);
}
}