Exemple #1
0
        public virtual bool Delete(object pk)
        {
            NET41 db   = new NET41();
            var   info = db.Set <T>().Find(pk);

            if (info == null)
            {
                return(false);
            }
            {
                db.Set <T>().Remove(info);
                return(db.SaveChanges() > 0);
            }
        }
Exemple #2
0
        public virtual bool Add(T info)
        {
            NET41 db = new NET41();

            db.Set <T>().Add(info);
            return(db.SaveChanges() > 0);
        }
Exemple #3
0
        public virtual List <T> GetAll()
        {
            //NET41 db = new NET41();
            //return db.Set<T>().ToList();

            NET41 db = new NET41();

            var list = (from item in db.Set <T>()
                        select item).ToList();

            return(list);
        }
Exemple #4
0
        public virtual List <T> Where(Expression <Func <T, bool> > predicate)
        {
            NET41 db = new NET41();

            return(db.Set <T>().Where(predicate).ToList());
        }
Exemple #5
0
        public virtual T GetByPK(object pk)
        {
            NET41 db = new NET41();

            return(db.Set <T>().Find(pk));
        }