Exemplo n.º 1
0
        public DalTopicTag Get(Expression<Func<DalTopicTag, bool>> filter)
        {
            var query = _dbSetTopicTags;

            return filter != null
                ? query.Where(filter.TypeConvert<DalTopicTag, TopicTag>()).SingleOrDefault().ToDalTopicTag()
                : default(DalTopicTag);
        }
Exemplo n.º 2
0
        public DalPost Get(Expression<Func<DalPost, bool>> filter)
        {
            var query = _dbSetPosts.Include(p => p.MembershipUser);

            return filter != null
                ? query.Where(filter.TypeConvert<DalPost, Post>()).SingleOrDefault().ToDalPost()
                : default(DalPost);
        }
Exemplo n.º 3
0
        public DalCategory Get(Expression<Func<DalCategory, bool>> filter)
        {
            var query = _dbSetCategories.Include(c=>c.Topics);

            return filter != null
                ? query.Where(filter.TypeConvert<DalCategory, Category>()).SingleOrDefault().ToDalCategory()
                : default(DalCategory);
        }
Exemplo n.º 4
0
        public DalMembershipUser Get(Expression<Func<DalMembershipUser, bool>> filter)
        {
            var query = _dbSetUsers.Include(x=>x.MembershipRoles);

            if (filter != null)
            {
                return query.Where(filter.TypeConvert<DalMembershipUser,MembershipUser>()).SingleOrDefault().ToDalUser();
            }
            return default(DalMembershipUser);
        }
Exemplo n.º 5
0
        public DalMembershipRole Get(Expression<Func<DalMembershipRole, bool>> filter)
        {
            var query = _dbSetRoles;

            if (filter != null)
            {
                return
                    query.Where(filter.TypeConvert<DalMembershipRole, MembershipRole>()).SingleOrDefault().ToDalRole();
            }
            return default(DalMembershipRole);
        }
Exemplo n.º 6
0
        public IEnumerable<DalPost> GetMany(Expression<Func<DalPost, bool>> filter)
        {
            IQueryable<Post> query = _dbSetPosts.Include(p => p.MembershipUser);

            if (filter == null)
            {
                return query.ToList().Select(user => user.ToDalPost());
            }

            return
                query.Where(filter.TypeConvert<DalPost, Post>())
                    .ToList()
                    .Select(user => user.ToDalPost());
        }
Exemplo n.º 7
0
        public IEnumerable<DalTopicTag> GetMany(Expression<Func<DalTopicTag, bool>> filter)
        {
            IQueryable<TopicTag> query = _dbSetTopicTags;

            if (filter == null)
            {
                return query.ToList().Select(user => user.ToDalTopicTag());
            }

            return
                query.Where(filter.TypeConvert<DalTopicTag, TopicTag>())
                    .ToList()
                    .Select(user => user.ToDalTopicTag());
        }
Exemplo n.º 8
0
        public DalTopic Get(Expression<Func<DalTopic, bool>> filter)
        {
            var query = _dbSetTopics
                .Include(t => t.Posts)
                .Include(t => t.TopicTags)
                .Include(t => t.MembershipUser);

            if (filter != null)
            {
                var result =
                    query.Where(filter.TypeConvert<DalTopic, Topic>()).SingleOrDefault();
                return result.ToDalTopic();
            }
            return default(DalTopic);
        }
Exemplo n.º 9
0
        public IEnumerable<DalMembershipRole> GetMany(Expression<Func<DalMembershipRole, bool>> filter)
        {
            IQueryable<MembershipRole> query = _dbSetRoles;

            if (filter == null)
            {
                return query.ToList().Select(user => user.ToDalRole());
            }

            return
                query.Where(filter.TypeConvert<DalMembershipRole, MembershipRole>())
                    .ToList()
                    .Select(user => user.ToDalRole());
        }
Exemplo n.º 10
0
        public IEnumerable<DalCategory> GetMany(Expression<Func<DalCategory, bool>> filter)
        {
            IQueryable<Category> query = _dbSetCategories.Include(c => c.Topics);

            if (filter == null)
            {
                return query.ToList().Select(user => user.ToDalCategory());
            }

            return
                query.Where(filter.TypeConvert<DalCategory, Category>())
                    .ToList()
                    .Select(user => user.ToDalCategory());
        }
Exemplo n.º 11
0
        public IEnumerable<DalMembershipUser> GetMany(Expression<Func<DalMembershipUser, bool>> filter)
        {
            IQueryable<MembershipUser> query = _dbSetUsers.Include(x => x.MembershipRoles);

            if (filter == null)
            {
                return query.ToList().Select(user => user.ToDalUser());
            }

            return query.Where(filter.TypeConvert<DalMembershipUser,MembershipUser>()).ToList().Select(user=>user.ToDalUser());
        }
Exemplo n.º 12
0
        public IEnumerable<DalTopic> GetMany(Expression<Func<DalTopic, bool>> filter)
        {
            IQueryable<Topic> query = _dbSetTopics
                .Include(t => t.Posts)
                .Include(t => t.TopicTags)
                .Include(t => t.MembershipUser);

            if (filter == null)
            {
                return query.ToList().Select(user => user.ToDalTopic());
            }

            return
                query.Where(filter.TypeConvert<DalTopic, Topic>())
                    .ToList()
                    .Select(user => user.ToDalTopic());
        }