Мне нужна модель представления, которая должна содержать In_time, date, Out_time, asset
Модель
public class Book_Model
{
[Key]
public int id { get; set; }
public string name { get; set; }
public string phone { get; set; }
public string department { get; set; }
public string asset { get; set; }
public string date { get; set; }
public TimeSpan In_time{ get; set;}
public TimeSpan Out_time{ get; set;}
}
Мой вид модели
public class Book_View
{
public string date { get; set; }
public TimeSpan In_time{ get; set; }
public TimeSpan Out_time{ get; set; }
public List<Book_Model> book { get; set; }
}
Контроллер
BookIn_View bv = new BookIn_View
{
book = db.bookm.Where(x => x.date == date && x.In_time >=
In_time&& x.out_time <= Out_time).ToList()
};
return View(bv);
View
@foreach (var item in Model.book)
{
@item.asset
}
но возвращаемая ссылка на объект не установлена для экземпляра объекта.
Помощь