I'm having the following problem: I'm trying to fetch a date. I just can not figure out an algorithm for this.
I have a class named RequisicaoDeVeiculo
, this class has the DataEHoraDoServico
attribute, and I have another class that MovimentacaoDeVeiculo
, which has the DataEHoraDaChegada
attribute, and the veiculo
class.
The RequisicaoDeVeiculo
class has the MovimentacaoDeVeiculo
and veiculo
classes. Assume that a user made a RequisicaoDeVeiculo
, and exited for a quest in Veículo
x on day 01/08/2018
ie DataEHoraDoServico
= 01/08/2018
, that vehicle returned on day 05/08/2018
, DataEHoraDaChegada
= 05/08/2018
. suppose a fine has been issued for this vehicle X , and the date of the fine is 03/08/2018
day. so I want to look at my system, who was on that date, with that vehicle. so I have a form on my system with a date , and a DropDow, to choose a vehicle . so I typed the following data into my form: data=03/08/2018
and Veículo=X
, so I have an action that gets data
and IdDoVeiculo
, and function so = >
var BuscarSolicitacaoPorDataEIdDoVeiculo = db.Meucontexto.Where(x => x.DataEHoraDoServico >= data && x.MovimentacaoDeVeiculo.DataEHoraDaChegada <= data && x.IdVeiculo = IdVeiculo);
This method does not work because it only looks for requests that are greater than or equal to date , so it only looks for requests that have been made on day 03/08/2018
or greater. however the DataEHoraDoServico
is equal to 01/08/2018
. can someone give me some help?