Hi
I have this code in ASP.NET to bind a data grid to a data source returned from EF:
Code:
--------
@(Html.Kendo().Grid<GarageBookingApp.Models.AdminViewModel>().Name("grid")
.Groupable()
.Sortable()
.Editable()
.Scrollable()
.ToolBar(x => x.Create())
.Columns(columns =>
{
columns.Bound(column => column.businessTimes.opening);
columns.Bound(column => column.businessTimes.closing);
columns.Command(column =>
{
column.Edit();
column.Destroy();
}).Width(230);
})
.DataSource(ds => ds.Ajax()
.Read(r => r.Action("GetBusinessTimes", "Home"))
.PageSize(10)
)
.Pageable()
)
The controller method is like this:
using (GarageContext gtx = new GarageContext())
{
return gtx.BusinessTimes.Select(businessTimes => new BusinessTimesEntity
{
closing = businessTimes.closing,
opening = businessTimes.opening
}).ToList();
I also notice that in the model, the properties are only "getted" but not set".
What am I missing to retrieve the database fields correctly here?