Hello.
I trying to check if a date is this date or bigger inside my linq query with boolean. But it's not working like i want.
This my code
public bool CheckMonth(int month)
{
if (month > System.DateTime.Now.Month)
{
return true;
}
else if (month == System.DateTime.Now.Month)
{
return true;
}
else
{
return false;
}
}
public virtual IList<DateItem> GetThreeDateToList()
{
var data = new ScoutDataDataContext();
var q = (from d in data.DateDetails
where d.Activate == 1 && CheckMonth(d.EndDate.Month)
orderby d.Date.Date.Month descending
select new DateItem
{
Title = d.Title,
Date = d.Date.Date + " - " + d.EndDate.Date,
Link = d.Link,
}).Take(3);
return q.ToList();
}
Anyone who nows a diffrent way?