Exemplo n.º 1
0
        public JSONCollection<TBL_DATO_EVENTO> Create(string NOMBRE_TIPO_EVENTO, string TIPO)
        {
            JSONCollection<TBL_DATO_EVENTO> objJSON = new JSONCollection<TBL_DATO_EVENTO>();
            try
            {
                TBL_DATO_EVENTO nuevo = new TBL_DATO_EVENTO()
                {
                    NOMBRE_TIPO_EVENTO = NOMBRE_TIPO_EVENTO,
                    TIPO = int.Parse(TIPO)
                };
                bd.TBL_DATO_EVENTO.InsertOnSubmit(nuevo);
                bd.SubmitChanges();

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