I have list which I want to order by like this
public class Refund {
public int RefundStatus { get; set; }
public DateTime SumbitTime { get; set; }
}
Order by RefundStatus
first, then:
if RefundStatus == 1
then by SumbitTime
ascending,
if RefundStatus != 1
then by SumbitTime
descending.
How should i do by linq to sql?
UPDATE: I made changes followed Michal Turczyn .but log output display could not be translated
Microsoft.EntityFrameworkCore.Query:Warning: The LINQ expression 'orderby [p].RefundStatus asc, ([p].SumbitTime.Ticks * Convert(IIF(([p].RefundStatus == 1), 1, -1), Int64)) asc, EF.Property(?[p]?, "Id") asc' could not be translated and will be evaluated locally. Microsoft.EntityFrameworkCore.Query:Warning: The LINQ expression 'orderby [p].RefundStatus asc, ([p].SumbitTime.Ticks * Convert(IIF(([p].RefundStatus == 1), 1, -1), Int64)) asc, EF.Property(?[p]?, "Id") asc' could not be translated and will be evaluated locally.