I have two strings, one of them for time only and the other for the date. I compare the concatenation with a DateTime.
I want to translate this SQl query to LINQ:
select count(*) from ViewAllTranUser
where TypeForm=15
and DateCreate +' '+ TimeCreate<='2022/11/06 02:49:51'
and NameButton=2)>0
With:
DateCreate:2021/01/15
TimeCreate:02:38:57
I want to get the count of rows where DateTime is less than the concatenation of a given date and time.
the Problem was receive date and Time and in database the date and time not in the same Field so I found the Solution by make the received as Text such as that can replace the date - by / such as
after that make text to collect the date and time not every one of them is seperated by making map
CreateMap<ViewAllTranUser, ViewAllTranUserDTO>() .ForMember(dest => dest.DateandTime, opt => opt.MapFrom(src => (src.DateCreate + ' ' + src.TimeCreate)));
and in the List Because The date be in arabic So I Make replace another for every item in list
var viewTransferList = _mapper.Map<List>(viewQuery);
after that To make Comparison ca't make it in string type so I translate it
at end Is successed