public ActionResult GridViewPartialUpdate(tcpjw3.oa.Models.BAT_VirtualAccount item) { var model = db.BAT_VirtualAccount; if (ModelState.IsValid) { try { var modelItem = model.FirstOrDefault(it => it.YHBH == item.YHBH); if (modelItem != null) { this.UpdateModel(modelItem); db.SaveChanges(); } } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(PartialView("_GridViewPartial", model.ToList())); }
public ActionResult GridViewPartialAddNew(tcpjw3.oa.Models.BAT_VirtualAccount item) { var model = db.BAT_VirtualAccount; 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())); }