I'm new to MVC. Trying out some sample code to list items from db.
public ActionResult Index()
{
var vendors = eproc_db.Vendors.ToList();
return View(vendors);
}
the above function returns all the records in the table. How do i make i开发者_JAVA技巧t return only those with status='A'
Similarly when I do edit, instead of "delete from", is it possible to do "update set status='D'..."
Not sure what your sample code has to do with stored procedures or ASP.NET MVC 3 (it is related to Entity Framework, or whatever this eproc_db.Vendors
is), but how about:
var vendors = eproc_db.Vendors.Where(x => x.status == "A").ToList();
精彩评论