I have a column in my table called DateTimeOfBid, I need to fetch all entities where DateTimeOfBid is within 30 days of today.
I’m using Entity-Framework 4 to access my data.
Here’s what I have so far:
EFUserAuctionLanceRepository userAuctionLanceRepository = new EFUserAuctionLanceRepository();
var potentialDiscount = userAuctionLanceRepository.FindAllUserAuctionLances()
.Where(u => u.UserId == user.UserId && u.AccountableForShopDiscount == true);
var discount = potentialDiscount.Where(p => p.DateTimeOfLance is within 30 days of today?)
How can I write this small query?
Define:
and then use the lambda expression
EF might need you to do the following, though: