User527076549 posted
HI,
i want to query result and display in order based on Id,Nam,Phone and Email can anyone help me how to do it. expected result
table1result=> table1.OrderBy(c => c.Id).ThenBy(c => c.Name).ThenBy(c => c.table2.Name).ThenBy(c=>c.table2.Phone)
below is sample code which results in
Func<IQueryable<T>, IOrderedQueryable<T>> orderExpression = o => o.OrderBy(a => a.Id);
switch(case)
{
case "Id" : orderExpression = o => o.OrderBy(a => a.Id);
break;
case "name" : orderExpression = o => o.OrderBy(a => a.Name);
break;
case "phone" : orderExpression = o => o.OrderBy(a => a.table2.phone);
break;
.
.
.
.
}
which result in
table1result=> table1.OrderBy(a => a.Id);
Thanks and Really appreciate your help