It is a API for a saleregister web. I want to select the sales of the pastweek, with sql this work for me
SELECT total, date FROM sale WHERE sale.idUser = 3 AND sale.date > '2020/06/16 01:42:45.270'
and that return some sales, but with EF i can't make it work(the date on the query lastweek, is the same on EF) I think that the problem is the
&& saleq.Date >lastweek
on EF, i tried to do it in diferent querys one to get the sales of a user, and another to take the sales of the past week with the value of the first EF query, but didn't work
DateTime lastweek = DateTime.Today;
lastweek = lastweek.AddDays(-7);
var query = from saleq in db.Sales
where saleq.IdUser == 3 && saleq.Date >lastweek
orderby saleq.Date descending
select saleq;
var lst = query.ToList();
the model on the api is the same on the database, when I use it to ask for all sales (without the date) it works