c# - EF Query - SQL "IN" - Same Table -


I need to get a list of user whose code , But only if the current user is concerned with the same organization .

In other words, if the current user does not have any connection with the organization in question, no results are returned. If there is a relationship then the results will be returned. This is a query yet, but it is only reusing an existing user for a user.

The questions below will clearly get all the active UserOrganization records where the value in the Organization ID query matches my question. Is that how do I take my current user ( UserId ) and make sure they set this result before returning to the record, then should not be able to see them?

  var dbUsers = db.UserOrganizations Where (u = & gt; u.OrganizationId == Organization ID). If if (active, u = & gt; u.IsActive)    

  var dbUsers = db.Organizations Where (o = & gt; O.OrganizationID == Organization ID & amp; User Anyone (U = & gt; u.UserId == Current User & amp; amp; U.E.Active)) Selecting (many = o = user.)   

If you can do something like: user through an organization / P>

  var dbUsers = db.Organizations. Where (o = & gt; O OrganizationId == Organization ID & amp; O User Organization. Any (U = & gt; u.User.UserId == Current User & amp; u.User.IsActive) Selection multiple (o => user user organization) (Uo = & gt; uo.User)    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -