Skip to content

Instantly share code, notes, and snippets.

Created July 12, 2017 09:51
Show Gist options
  • Save anonymous/8f7859ac7637338fcda0233eb1e362f4 to your computer and use it in GitHub Desktop.
Save anonymous/8f7859ac7637338fcda0233eb1e362f4 to your computer and use it in GitHub Desktop.
string[] Teletype = new string[] { "00", "01" };
CustomerInfo customInfo = null;
customInfo = (from p in _context.registry
join t in _context.phone on new { key = p.signum } equals new { t.key } into lt
join tp in _context.post on new { postnumber = p.postnr, lang = language } equals new { tp.postnumber, tp.lang } into ltp
let t = lt.FirstOrDefault()
let tp = ltp.FirstOrDefault()
where p.signum == signum && t.codetype == "00" && Teletype.Contains(t.teltype)
select new CustomerInfo()
{
FirstName = p.fnamn,
LastName = p.lnamn,
MainName = p.fnamn,
ZipCodeAndName = p.postnr + " " + tp.postlocation,
Signum = p.signum,
Address = p.adress2 ?? p.adress,
Telephone = t.telnr ?? t2.telnr,
MainLanguage = p.moderspr,
CommunicationLanguage = p.commLang,
RegionCode = p.rcode,
}).SingleOrDefault();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment