Пример #1
0
        private void shiftIndexes(Category entry, int oldIndex, System.Data.Entity.DbSet <Category> dbset)
        {
            if (entry.Index - oldIndex == 1)
            {
                //Move forward by 1 step
                try
                {
                    dbset.First(x => x.Index == entry.Index).Index = oldIndex; //If was last row - it will throw an exception
                }
                catch (Exception e)
                { }
            }
            else if (entry.Index > oldIndex)
            {
                //We moved forward
                foreach (var q in dbset.ToList())
                {
                    if (oldIndex < q.Index && q.Index < entry.Index)
                    {
                        q.Index = q.Index - 1;
                    }
                }
                entry.Index = entry.Index - 1;
            }
            else if (entry.Index < oldIndex)
            {
                //We moved backwards
                foreach (var q in dbset.ToList())
                {
                    if (entry.Index <= q.Index && q.Index < oldIndex)
                    {
                        q.Index = q.Index + 1;
                    }
                }
            }

            if (entry.Index > dbset.Count())
            {
                entry.Index = dbset.Count();
            }
            else if (entry.Index < 1)
            {
                entry.Index = 1;
            }
        }
 public List <T> GetAll()
 {
     return(dbSet.ToList());
 }
Пример #3
0
 public virtual IEnumerable <TEntity> GetAll()
 {
     return(_entitySet.ToList());
 }
Пример #4
0
 public IEnumerable <TEntity> FindAll()
 {
     return(_dbSet.ToList());
 }