Я хочу выбрать данные формата даты и времени из базы данных.
У меня есть 3 модели.
School
public int Id { get; set; }
public ICollection<SchoolStore> SchoolStores { get; set; }
SchoolStores
public int SchoolId { get; set; }
public School School { get; set; }
public ICollection<Event> Events { get; set; }
Events
public DateTime Date { get; set; }
public EventStatus Status { get; set; }
Метод выглядит как
public IQueryable<SchoolProjectionModel> GetAllForList()
{
return dataContext.Schools.AsNoTracking().IgnoreQueryFilters()
.Select(s => new SchoolListProjectionModel()
{
publishedEventDate = s.SchoolStores.Select(ss => ss.Events
.Where(ee => ee.Status == EventStatus.Published && ee.SchoolId == s.Id)
.Select(ed => ed.Date)
.Where(ses => ses.Date >= DateTime.Today))
});
}
Но я получаю такую ошибку
Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<System.DateTime>'
to 'System.DateTime'
Я ожидаю получить данные формата даты и времени из базы данных.
SchoolListProjectionModel
using System.Collections.Generic;
using System;
public class SchoolListProjectionModel
{
public DateTime publishedEventDate { get; set; }
}