Base solution for your next web application
Open Closed

Linq question: Get OrganizationUnits including Member Names #2418


User avatar
0
rvanwoezik created

Hi, for a certain view i like to have All OrganizationUnits include there Members -> Member Name and ProfilePic. I'm banging my head against my keyboard but still can get it right.

I Tried this, but result is empty

var query = from uou in _userOrganizationUnitRepository.GetAll()
                        join ou in _organizationUnitRepository.GetAll() on uou.OrganizationUnitId equals ou.Id
                        join user in UserManager.Users on uou.UserId equals user.Id
                        where uou.OrganizationUnitId == input.Id
                        orderby input.Sorting
                        select new { uou, user };

Please advice


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Do you have an exception ? Because your code seems fine and it worked for me. I have removed sorting and used 1 as static organization unit Id.

    Does the organization unit belongs to logged in user's tenant ? This is the only thing comes to my mind for now.