Esempio n. 1
0
        public T Update <T>(T model) where T : class
        {
            using (UrunTakipContext urunTakipContext = new UrunTakipContext())
            {
                urunTakipContext.Set <T>().Update(model);
                urunTakipContext.SaveChanges();
            }

            return(model);
        }
Esempio n. 2
0
        public void Delete <T>(int id) where T : class
        {
            T model = Find <T>(id);

            using (UrunTakipContext urunTakipContext = new UrunTakipContext())
            {
                urunTakipContext.Set <T>().Remove(model);
                urunTakipContext.SaveChanges();
            }
        }
Esempio n. 3
0
        public IQueryable <T> Get <T>() where T : class
        {
            IQueryable <T> models;

            using (UrunTakipContext urunTakipContext = new UrunTakipContext())
            {
                models = urunTakipContext.Set <T>();
            }

            return(models);
        }
Esempio n. 4
0
        public T Find <T>(int id) where T : class
        {
            T product;

            using (UrunTakipContext urunTakipContext = new UrunTakipContext())
            {
                product = urunTakipContext.Set <T>().Find(id);
            }

            return(product);
        }