예제 #1
0
        public ICollection <ITag> FindAll()
#endif
        {
            var tags = (DataContext != null)
                           ? FindAllQuery.Invoke(DataContext)
                           : Database.TagDataSource.OrderBy(t => t.Name);

            return(tags.AsEnumerable().Cast <ITag>().ToList().AsReadOnly());
        }
예제 #2
0
        public ICollection<ICategory> FindAll()
#endif
        
        {
            var categories = (DataContext != null)
                                 ? FindAllQuery.Invoke(DataContext)
                                 : Database.CategoryDataSource.OrderBy(c => c.CreatedAt);
            
            return categories.AsEnumerable()
                             .Cast<ICategory>()
                             .ToList()
                             .AsReadOnly();
        }
예제 #3
0
        public PagedResult <IUser> FindAll(int start, int max)
#endif
        {
            Check.Argument.IsNotNegative(start, "start");
            Check.Argument.IsNotNegative(max, "max");

            int total = Database.UserDataSource.Count(u => u.IsActive && !u.IsLockedOut && u.AssignedRole == (int)Roles.User);
            IQueryable <User> users;

            if (DataContext != null)
            {
                users = FindAllQuery.Invoke(DataContext, start, max);
            }
            else
            {
                users = Database.UserDataSource
                        .Where(u => u.IsActive && !u.IsLockedOut && u.AssignedRole == (int)Roles.User)
                        .OrderBy(u => u.UserName)
                        .ThenByDescending(u => u.LastActivityAt);
            }
            return(BuildPagedResult <IUser>(users.AsEnumerable(), total));
        }