public virtual void Update(params T[] items)
 {
     using (var context = new FantasySportsEntities())
     {
         foreach (T item in items)
         {
             context.Entry(item).State = EntityState.Modified;
         }
         context.SaveChanges();
     }
 }
        public virtual T GetSingle(Func <T, bool> where, params Expression <Func <T, object> >[] navigationProperties)
        {
            T item = null;

            using (var context = new FantasySportsEntities())
            {
                IQueryable <T> dbQuery = context.Set <T>();

                //Apply eager loading
                foreach (Expression <Func <T, object> > navigationProperty in navigationProperties)
                {
                    dbQuery = dbQuery.Include <T, object>(navigationProperty);
                }

                item = dbQuery
                       .AsNoTracking()         //Don't track any changes for the selected item
                       .FirstOrDefault(where); //Apply where clause
            }
            return(item);
        }
        public virtual IList <T> GetAll(params Expression <Func <T, object> >[] navigationProperties)
        {
            List <T> list;

            using (var context = new FantasySportsEntities())
            {
                IQueryable <T> dbQuery = context.Set <T>();

                //Apply eager loading
                foreach (Expression <Func <T, object> > navigationProperty in navigationProperties)
                {
                    dbQuery = dbQuery.Include <T, object>(navigationProperty);
                }

                list = dbQuery
                       .AsNoTracking()
                       .ToList <T>();
            }
            return(list);
        }