Cleaned up readme sample

This commit is contained in:
Koen Bekkenutte
2021-06-04 02:03:36 +08:00
parent 4db518896b
commit 7ba1caa133
3 changed files with 10 additions and 5 deletions

View File

@@ -11,7 +11,10 @@ namespace ReadmeSample.Extensions
public static class UserExtensions
{
[Projectable]
public static Order GetMostRecentOrderForUser(this User user, DateTime? cutoffDate)
=> user.Orders.Where(x => x.CreatedDate >= cutoffDate).OrderByDescending(x => x.CreatedDate).FirstOrDefault();
public static Order GetMostRecentOrderForUser(this User user, bool includeUnfulfilled) =>
user.Orders
.Where(x => !includeUnfulfilled ? x .FulfilledDate != null : true)
.OrderByDescending(x => x.CreatedDate)
.FirstOrDefault();
}
}