Skip to content

Instantly share code, notes, and snippets.

@oguzhankircali
Created May 30, 2019 15:08
Show Gist options
  • Save oguzhankircali/de53cc18b6f22feb41a1c03d9bde2db0 to your computer and use it in GitHub Desktop.
Save oguzhankircali/de53cc18b6f22feb41a1c03d9bde2db0 to your computer and use it in GitHub Desktop.
var baseData = await q.Skip(request.SkipCount).Take(request.MaxResultCount).ToListAsync();
var q2 = from t in baseData
join a in await _customerManager.GetAllAgentFromCacheAsync() on t.OldAgentCode equals a.MustKod into oldAgent
from a in oldAgent.DefaultIfEmpty()
join aNew in await _customerManager.GetAllAgentFromCacheAsync() on t.NewAgentCode equals aNew.MustKod into newAgent
from aNew in newAgent.DefaultIfEmpty()
join p in _planRepository.GetAll() on t.PlanId equals p.Id into plan
from p in plan.DefaultIfEmpty()
join pr in _productRepository.GetAll() on t.ProductId equals pr.Id into product
from pr in product.DefaultIfEmpty()
join ph in _customerManager.GetAllMusteri() on
new { MustKod = t.PolicyHolderMustKod, KaynakKodu = t.OldSourceCode, SubeKod = t.OldBranchCode }
equals
new { ph.MustKod, ph.KaynakKodu, ph.SubeKod } into holder
from ph in holder.DefaultIfEmpty()
select new AgencyPortfolioTransferDto()
{
Id = t.Id,
OldAgentName = a?.Isim,
NewAgentName = aNew?.Isim,
ProductName = pr.ToString(),
PlanName = p?.DisplayNameWithIdAndCode,
MustKod = t.PolicyHolderMustKod,
PolicyHolderName = t.PolicyHolderMustKod,
StartDate = t.StartDate,
EndDate = t.EndDate,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment