Guest User

Untitled

a guest
Feb 22nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. var personWithLocation = context.Persons
  2. .SelectMany(p => context.ViewPersonLastLocations
  3. .Where(vp => vp.person_id == p.id)
  4. .DefaultIfEmpty(),
  5. (p, vp) => new PersonViewModel // create a viewmodel for results or anonymous
  6. {
  7. Id = p.id,
  8. Name = p.name,
  9. LastName = p.lastname,
  10. LocationName = vp.location_name
  11. }
  12. ).ToList();
Add Comment
Please, Sign In to add comment