Skip to content

Instantly share code, notes, and snippets.

@lgolubyev
Created June 16, 2022 13:17
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 lgolubyev/fa812022bcb505a0badeb74df52bdbe7 to your computer and use it in GitHub Desktop.
Save lgolubyev/fa812022bcb505a0badeb74df52bdbe7 to your computer and use it in GitHub Desktop.
from user in _dbContext.Set<User>().AsNoTracking()
where user.Id == userId
let name = $"{user.FirstName} {user.LastName}"
let hasFirstName = !string.IsNullOrEmpty(user.FirstName)
let hasLastName = !string.IsNullOrEmpty(user.LastName)
select new
{
user.Id,
Name = name,
ProfileComplete = hasFirstName && hasLastName
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment