hi I have a case when i want to compare only date of datetime object. how can i achieve it without converting it to string.
public bool CheckSendEmailWithinCalendarDay(UnifiedUser user, string messageId, DateTime whenSent) { var result = _ctx.UserSpecificMessageHistories .Where(u => u.UserId == user.User.UserId) .Where(d => d.WhenSent.Date == whenSent.Date) .FirstOrDefault(m => m.EmailTemplate.Id == messageId); return Convert.ToBoolean(result); }
Date
here:d.WhenSent.Date == whenSent.Date
isn't it working ok? - Kamil Budziewski