Get RowNumber with linq to sql in c#

Query:

var itemlist = db.Items.Where(x =>  x.UserId == Id && DbFunctions.TruncateTime(x.LoanDueDate.Value) < DbFunctions.TruncateTime(DateTime.Now)).AsEnumerable().Select((r, i) => new { i=i+1, r }).ToList();


Try using this query, It'll help :)

Comments

Popular posts from this blog

SQL Interview Questions and Answers

Generic Interface and Factory Pattern in C#

How to get device info IMEI programmatically in xamarin android