c# - How can I convert a 'System.Linq.IQueryable<System.Collections.Generic.ICollection<ApplicationUser>> to IList<ApplicationUser>? -


in project want display list of users in project. projects , users have many many relationship in database. query users via

var users = dbcontext.projects.select( u => u.users); 

this gives me object of type iqueryable> display model requires type of ilist can display on view page.

please how can convert between 2 or helpful suggestions.

you need use selectmany() flatten list , tolist() convert list:

var users = dbcontext.projects.selectmany( u => u.users).tolist(); 

Comments

Popular posts from this blog

jquery - How do you format the date used in the popover widget title of FullCalendar? -

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -