开发者

MVC 3 - Using Stored Procedures to populate model

开发者 https://www.devze.com 2023-04-01 03:06 出处:网络
I\'m new to MVC. Trying out some sample code to list items from db. public ActionResult Index() { var vendors = eproc_db.Vendors.ToList();

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();
0

精彩评论

暂无评论...
验证码 换一张
取 消