find users that are following other users
- by Jakob
Hi I'm wondering how I can go about this problem
I have a DB with a Users Table, and a Followers table.
The Followers table contains 2 Columns "FollowerID" and "FollowedID"
I have a 1 - * relation in my datamodel between Users.ID -> Followers.FollowerID and Users.ID -> FollowedID
How do I in LINQ get a set of users that are following a specific user?
I'll express what I'm trying to achieve programatically
I can get this far:
ctx.Followers.Where(f => f.FollowedID == CurrentUser.ID)
so now i have a Followers set where I have the ID of the users that follow the CurrentUser, and I could iterate through this collection and then add users after each iteration to a collection that would be a total USER collection that followed CurrentUser, but isn't there a smarter, or LINQ'er way to do this?
Much appreciated
Thx