예제 #1
0
        private preferencia getSeriePref()
        {
            preferencia pref = (from p in DBManager.Context.preferencias
                                where p.nombre == "copia_serie"
                                select p).FirstOrDefault();

            return(pref);
        }
예제 #2
0
        public async Task <preferencia> FindContentChanged()
        {
            preferencia result = await(from r in DBManager.Context.preferencias
                                       where r.nombre == CONTENT_CHANGED_KEY
                                       select r).FirstOrDefaultAsync();

            return(result);
        }
예제 #3
0
        public void SetContentUnchangedRegistry()
        {
            preferencia pref = (from r in DBManager.Context.preferencias
                                where r.nombre == CONTENT_CHANGED_KEY
                                select r).FirstOrDefault();

            if (pref != null)
            {
                pref.valor_int = 0;
                Update(pref);
            }
        }
예제 #4
0
        public int NextSerie()
        {
            preferencia pref = this.getSeriePref();

            if (pref != null && pref.valor_int != null)
            {
                return((int)pref.valor_int);
            }
            else
            {
                return(-1);
            }
        }
예제 #5
0
        public copia Add(copia entity)
        {
            try {
                copia c = DBManager.Context.copias.Add(entity);
                DBManager.Context.SaveChanges();

                if (c != null)
                {
                    preferencia pref = this.getSeriePref();
                    pref.valor_int++;

                    DBManager.Context.Entry(pref).State = EntityState.Modified;
                    DBManager.Context.SaveChanges();
                }

                return(c);
            }
            catch (System.Exception e)
            {
                throw e;
            }
        }
예제 #6
0
 public void Update(preferencia entity)
 {
     DBManager.Context.Entry(entity).State = EntityState.Modified;
     DBManager.Context.SaveChanges();
 }