I’m new to LINQ and need some help with a query.

I need all of the **Resources** from (tblResources) that belong to the ***Anonymous***, and ***Public*** **ResourceGroups** (tblResourceGroups). In addition, I also need all of the **Resources** that belong to any of the **ResourceGroups** that the ***currentUser*** belongs to.

If the ***currentUser*** isn’t logged in (currentUser == null) then only **Resources** belonging to ***Anonymous***, and ***Public*** **ResourceGroups** should be returned.

NOTE: My data model does not contain an entity for tblResourceAccess. I'm not sure why this entity wasn't added when the model was created.

```
        string currentUser = IdentityHelper.GetUserIdFromRequest(Context.Request);

        var result = from r in DbContext.Resources                                                                           
                     where r.Active == true // && r.ResourceGroups?????                         
                     select new
                     {                                                          
                         ResourceTypeName = r.ResourceType.Name,
                         Name = r.Name,
                         Version = r.Version,
                         Description = r.Description,
                         Path = r.Path,
                         Active = r.Active
                     };

```

[![Entity Data Models](https://i.stack.imgur.com/5ug1N.png)](https://i.stack.imgur.com/5ug1N.png)

[![Database Tables](https://i.stack.imgur.com/IX8a9.png)](https://i.stack.imgur.com/IX8a9.png)