Skip to content
Loading
  • Laxmidhar Sahoo
    0
    1. var res = from c in db.Cases     
    2.        join p in db.Payer on c.payerid equals p.id     
    3.        where c.CompanyId != null  
    4.        group new { , bp } by new { c.payerid } into g      
    5.       let firstpayergroup = g.FirstOrDefault()  
    6.       let case = firstpayergroup.c  
    7.       let pay = firstpayergroup.p  
    8.     let totCollection = g.Sum(x => x.Collection)   
    9.     let avgCollection = g.Average(x => x.Collection),    
    10.       select new payerMinMax  
    11.     {  
    12.     name = pay.payername,  
    13.     avgCollection = avgCollection,    
    14.          totCollection = totCollection    
    15.     };    
    16.         
    17.   
    18.   
    19. here payerMinMax is a class having properties like name,avgCollection,totCollection  
    0