public ActionResult GridViewPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Testiranje2.Models.Ispit item) { var model = db.Ispits; if (ModelState.IsValid) { try { using (StudentEntities se = new StudentEntities()) { se.Entry(item).State = EntityState.Modified; se.SaveChanges(); } } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(PartialView("_GridViewPartial", model.ToList())); }
public ActionResult GridViewPartialAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] Testiranje2.Models.Ispit item) { var model = db.Ispits; if (ModelState.IsValid) { try { model.Add(item); db.SaveChanges(); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(PartialView("_GridViewPartial", model.ToList())); }