public ActionResult GridViewPartialUpdate(DXWebMRCS.Models.Questionnaire item) { var model = db1.Questionnaire; if (ModelState.IsValid) { try { var modelItem = model.FirstOrDefault(it => it.QID == item.QID); if (modelItem != null) { this.UpdateModel(modelItem); db1.SaveChanges(); } } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(PartialView("_GridViewPartial", model.ToList())); }
public ActionResult GridViewPartialAddNew(DXWebMRCS.Models.Questionnaire item) { var model = db1.Questionnaire; if (ModelState.IsValid) { try { model.Add(item); db1.SaveChanges(); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(PartialView("_GridViewPartial", model.ToList())); }