public ActionResult BundleLinAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] BundleLinModel item) { var model = Session[session] as List <BundleLinModel>; try { if (ModelState.IsValid) { if (model.Any(f => f.Id == item.Id)) { ModelState.AddModelError("Id", string.Format(General.ErrorRegistroExistente)); } else { var max = model.Any() ? model.Max(f => f.Id) + 1 : 1; item.Id = max; model.Add(item); Session[session] = model; } } } catch (ValidationException) { model.Remove(item); throw; } return(PartialView("_BundleLin", model)); }
public ActionResult BundleLinUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] BundleLinModel item) { var model = Session[session] as List <BundleLinModel>; try { if (ModelState.IsValid) { var editItem = model.Single(f => f.Id == item.Id); editItem.Descripcion = item.Descripcion; Session[session] = model; } } catch (ValidationException) { throw; } return(PartialView("_BundleLin", model)); }