I'm currenty manage to get some time to work on ASP.NET MVC. I'm doing the tutorial Create a Movie Database in ASP.NET MVC, which still uses the ADO.NET Enity Model. I managed to create a List View from the LINQ Entity Model. So here is my problem. The Bind Attribute doesn't work on my SQL Entity.
Original Code with Ado.NET
public ActionResult Create([Bind(Exclude="Id")] Movie movieToCreate)
{
if (!ModelState.IsValid)
return View();
_db.AddToMovieSet(movieToCreate);
_db.SaveChanges();
return RedirectToAction("Index");
}
My LINQ Code
public ActionResult Create([Bind(Exclude = "Id")] Movies movieToCreate)
{
if (!ModelState.IsValid)
{
return View();
}
_db_linq.Movies.InsertOnSubmit(movieToCreate);
_db_linq.SubmitChanges();
return RedirectToAction("Index");
}
But the Id Field isn't excluded. Any Ideas? Thanks!