Skip to content

Instantly share code, notes, and snippets.

@codehaks
Created May 9, 2021 07:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codehaks/2ad775c9740efd9a238d8adad678d755 to your computer and use it in GitHub Desktop.
Save codehaks/2ad775c9740efd9a238d8adad678d755 to your computer and use it in GitHub Desktop.
User roles
[Route("api/user/roles")]
public IActionResult UserRoles()
{
var q1 = from userRole in _shopDbContext.UserRoles
join role in _shopDbContext.Roles on userRole.RoleId equals role.Id
join user in _shopDbContext.Users on userRole.UserId equals user.Id
select new
{
user.Id,
user.FirstName,
user.LastName,
role.Name
};
return Ok(q1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment