public JSONCollection<TBL_ACCION> Create(string NOMBRE_ACCION) { JSONCollection<TBL_ACCION> objJSON = new JSONCollection<TBL_ACCION>(); try { TBL_ACCION nuevo = new TBL_ACCION() { NOMBRE_ACCION = NOMBRE_ACCION }; bd.TBL_ACCION.InsertOnSubmit(nuevo); bd.SubmitChanges(); objJSON.items = nuevo; objJSON.totalCount = bd.TBL_ACCION.Count(); objJSON.success = true; } catch (Exception e) { objJSON.success = false; } return objJSON; }
public JSONCollection<TBL_ACCION> Update(string id, TBL_ACCION nuevo) { JSONCollection<TBL_ACCION> objJSON = new JSONCollection<TBL_ACCION>(); try { var objeto = (from variable in bd.TBL_ACCION where variable.ID_ACCION == int.Parse(id) select variable).Single(); objeto.NOMBRE_ACCION = nuevo.NOMBRE_ACCION; bd.SubmitChanges(); objJSON.items = objeto; objJSON.totalCount = bd.TBL_ACCION.Count(); objJSON.success = true; } catch (Exception ex) { objJSON.success = false; } return objJSON; }
public JSONCollection<TBL_ACCION> Update(string id, TBL_ACCION nuevo) { throw new Exception("No implementado"); }