public ActionResult AgencyListPartialUpdate(tcpjw3.oa.Models.UserMap item) { var model = db.UserMap; 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("_AgencyListPartial", model.OrderByDescending(um => um.ID).ToList())); }
public ActionResult AgencyListPartialAddNew([Bind(Include = "AgencyId,UserId,Note")] tcpjw3.oa.Models.UserMap item) { var model = db.UserMap; 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("_AgencyListPartial", model.OrderByDescending(um => um.ID).ToList())); }