Hi
Using ajax my data source is configured as follow:
When my grid first loads all the related entities with data comes through from the repository just fine:
But as soon as I do an update my related entities seems to be populated but all properties set to null:
Please see attached file for a screenshot from VS.
Can someone please tell me why this is and what I'm doing wrong here?
Thanks
Using ajax my data source is configured as follow:
.Read(read => read.Action("Containers_Read", "ContainerAdmin"))
.Create(update => update.Action("Containers_Create", "ContainerAdmin"))
.Update(update => update.Action("Containers_Update", "ContainerAdmin"))
.Destroy(update => update.Action("Containers_Delete", "ContainerAdmin"))
public ActionResult Containers_Read([DataSourceRequest] DataSourceRequest request)
{
return Json(_repository.GetAllAssetTakeOnContainers().ToDataSourceResult(request));
}
public List<
AssetTakeOnContainer
> GetAllAssetTakeOnContainers()
{
using (var context = new AssetTakeOnContext())
{
context.Configuration.LazyLoadingEnabled = false;
return context.AssetTakeOnContainers.Include("TakeOns").Include("LocationLevel1").Include("LocationLevel2").Include("LocationLevel3").Include("CostCntrLevel1").Include("CostCntrLevel2").Include("CostCntrLevel3").Include("Contact").Include("RoomType").Where(c => c.IsDeleted == false).ToList();
}
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Containers_Update([DataSourceRequest] DataSourceRequest request, AssetTakeOnContainer container)
{
_repository.UpdateAssetTakeOnContainer(container);
return Json(ModelState.ToDataSourceResult());
}
Can someone please tell me why this is and what I'm doing wrong here?
Thanks