Link to home
Create AccountLog in
Avatar of ToString1
ToString1

asked on

linq to sql check for role in many to many relationship

I am not using membership provider

I have 3 tables

User, Role, UserRole

User -            UserID, Name
Role -             RoleID, RoleName
UserRole -     UserID, RoleID

I have 3 roles
Admin, TeamAdmin, User

In linq to sql I am getting the logged in user and now need to check if they are in roles and then assign a bool to say which role they are in

bool IsUserAdmin
bool IsUserTeamAdmin
bool User

What is the best way in linq to sql to get the user and check if they are in one or both roles?





 
ASKER CERTIFIED SOLUTION
Avatar of kumar754
kumar754
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer