public ActionResult CaracteristicasLinAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] CaracteristicasLinModel item) { var model = Session[session] as List <CaracteristicasLinModel>; try { if (ModelState.IsValid) { if (model.Any(f => f.Id == item.Id)) { ModelState.AddModelError("Id", string.Format(General.ErrorRegistroExistente)); } else { item.Id = Funciones.RellenaCod(item.Id, 2); model.Add(item); Session[session] = model; } } } catch (ValidationException) { model.Remove(item); throw; } return(PartialView("_Caracteristicaslin", model)); }
public ActionResult CaracteristicasLinUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] CaracteristicasLinModel item) { var model = Session[session] as List <CaracteristicasLinModel>; try { if (ModelState.IsValid) { var editItem = model.Single(f => f.Id == item.Id); editItem.Descripcion = item.Descripcion; editItem.Descripcion2 = item.Descripcion2; editItem.Descripcionabreviada = item.Descripcionabreviada; Session[session] = model; } } catch (ValidationException) { throw; } return(PartialView("_Caracteristicaslin", model)); }