Sushant Torankar

Sushant Torankar

  • 1.5k
  • 261
  • 28.7k

lambda expression with sum and where condition

Jul 20 2022 11:37 AM

hello,

I want to calculate total filesize of user, using lambda expression with SUM and WHERE condition,  but it;s giving some parse error

FileSize column is of datatype DOUBLE. Following is my code :

var total = await _context.LogsMasters.Where(p => p.UserId == Id).Sum(p => p.FileSize);

return total;

how to achieve that or any other wayt to get it?

I can get that total using store procedure, but I want to go with entity framework code directly

 

thank you

 

 

 


Answers (2)