public ActionResult GridViewFilterPartialUpdate(CC.Models.Database.Filter item) { var model = dbFilter.Filters; if (ModelState.IsValid) { try { var modelItem = model.FirstOrDefault(it => it.id == item.id); if (modelItem != null) { this.UpdateModel(modelItem); dbFilter.SaveChanges(); } } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(PartialView("_GridViewFilterPartial", BusinessLogic.Home.Filter.GetFilterModel())); }
public ActionResult GridViewFilterPartialAddNew(CC.Models.Database.Filter item) { var model = dbFilter.Filters; if (ModelState.IsValid) { try { item.user_id = MySession.Current.UserGuid; model.Add(item); dbFilter.SaveChanges(); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else { ViewData["EditError"] = "Please, correct all errors."; } return(PartialView("_GridViewFilterPartial", BusinessLogic.Home.Filter.GetFilterModel())); }