Using EntityCollection in MVC project

Posts   
 
    
Anthony
User
Posts: 155
Joined: 04-Oct-2006
# Posted on: 20-Jun-2011 08:39:41   

vs2010,llblgen 2.6,c#,adapter

Want to return an enitycollection as the model used by the view but i cannot get it working.


        public ActionResult news()
        {
            ViewData["Title"] = "News";

            EntityCollection<TblNewsEntity> oNews = new EntityCollection<TblNewsEntity>();
            NewsDB oBLNews = new NewsDB();

            oNews = oBLNews.GetNews(null).ToList();//doeesn't work
            oNews = oBLNews.GetNews(null);//doeesn't work

            return View(oNews);
        }

What should i do to get it working...

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 20-Jun-2011 09:54:39   

oNews = oBLNews.GetNews(null).ToList();//doeesn't work oNews = oBLNews.GetNews(null);//doeesn't work

I don't have much experience with MVC. Could you tell me, What does GetNews() do? What's the return type?

Anthony
User
Posts: 155
Joined: 04-Oct-2006
# Posted on: 20-Jun-2011 12:55:04   

Sorry its afunction i created that returns an enitycollection(of tblnewsentity) . I just need a method to return the enitycollection as a view model

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 20-Jun-2011 16:27:37   

I guess you mean having EntityCollection as a ModelBinder compatible. Would this thread be helpful to you: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=17504