开发者

MVC 3 - Using Stored Procedures to populate model

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜