I create a view, entity model and Devexpress Grid extension. Devexpress has self generate a code. But UpdateModal function is not working on controller function in class. throw a "The model of type 'Models.Birim' could not be updated." error text.
my codes:
[HttpPost, ValidateInput(false)]
public ActionResult MagazaGridPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Models.Birim item)
{
var model = db.Birim;
if (ModelState.IsValid)
{
try
{
var modelItem = model.FirstOrDefault(it => it.id == item.id);
if (modelItem != null)
{
this.UpdateModel(modelItem);
db.SaveChanges();
}
}
catch (Exception e)
{
ViewData["EditError"] = e.Message;
}
}
else
ViewData["EditError"] = "Please, correct all errors.";
return PartialView("_MagazaGridPartial", model.ToList());
}
can it work on my work idea?