I am trying to compare 24 hour time format stored as a string to the current time as follows
[AllowAnonymous]
public ActionResult _ProgOn()
{
int i = (int)DateTime.Now.DayOfWeek;
DateTime dt = DateTime.Now;
var onNow = db.Programs
.Where(u => u.PrOk == true)
.Where(u => u.DaId == i)
.Where(u => u.TimeOn == dt.ToString("HH:mm"));
return PartialView(onNow);
But that seems not to be acceptable to Linq query. I will be grateful if I am pointed to the right direction.
Pass time string to Linq query:
Also you don’t need to compare boolean value with true/false. And I think query syntax looks better here.