Exemplo n.º 1
0
        public JSONCollection<TBL_DIVISION> Create(string NOMBRE_DIVISION)
        {
            JSONCollection<TBL_DIVISION> objJSON = new JSONCollection<TBL_DIVISION>();
            try
            {
                TBL_DIVISION nuevo = new TBL_DIVISION()
                {
                    NOMBRE_DIVISION = NOMBRE_DIVISION
                };
                bd.TBL_DIVISION.InsertOnSubmit(nuevo);
                bd.SubmitChanges();

                objJSON.items = nuevo;
                objJSON.totalCount = bd.TBL_DIVISION.Count();
                objJSON.success = true;
            }
            catch (Exception e)
            {
                objJSON.success = false;
            }
            return objJSON;
        }
Exemplo n.º 2
0
 public JSONCollection<TBL_DIVISION> Update(string id, TBL_DIVISION nuevo)
 {
     JSONCollection<TBL_DIVISION> objJSON = new JSONCollection<TBL_DIVISION>();
     try
     {
         var objeto = (from variable in bd.TBL_DIVISION
                       where variable.ID_DIVISION == int.Parse(id)
                       select variable).Single();
         objeto.NOMBRE_DIVISION = nuevo.NOMBRE_DIVISION;
         bd.SubmitChanges();
         objJSON.items = objeto;
         objJSON.totalCount = bd.TBL_DIVISION.Count();
         objJSON.success = true;
     }
     catch (Exception ex)
     {
         objJSON.success = false;
     }
     return objJSON;
 }