public IEnumerable <RoleEntity> GetAllByPredicate(Expression <Func <RoleEntity, bool> > f)
        {
            var visitor = new HelperExpressionVisitor <RoleEntity, DalRole>(Expression.Parameter(typeof(DalRole), f.Parameters[0].Name));
            var exp2    = Expression.Lambda <Func <DalRole, bool> >(visitor.Visit(f.Body), visitor.NewParameterExp);

            return(roleRepository.GetAllByPredicate(exp2).Select(r => r.GetBllEntity()));
        }
Exemple #2
0
        public ArticleEntity GetOneByPredicate(Expression <Func <ArticleEntity, bool> > f)
        {
            var visitor = new HelperExpressionVisitor <ArticleEntity, DalArticle>(Expression.Parameter(typeof(DalArticle), f.Parameters[0].Name));
            var exp2    = Expression.Lambda <Func <DalArticle, bool> >(visitor.Visit(f.Body), visitor.NewParameterExp);

            return(articleRepository.GetOneByPredicate(exp2).GetBllEntity());
        }
Exemple #3
0
        public IEnumerable <ArticleEntity> GetAllByPredicate(Expression <Func <ArticleEntity, bool> > f)
        {
            var visitor = new HelperExpressionVisitor <ArticleEntity, DalArticle>(Expression.Parameter(typeof(DalArticle), f.Parameters[0].Name));
            var exp2    = Expression.Lambda <Func <DalArticle, bool> >(visitor.Visit(f.Body), visitor.NewParameterExp);

            //ToList()
            return(articleRepository.GetAllByPredicate(exp2).Select(article => article.GetBllEntity()).ToList());
        }
Exemple #4
0
        public IEnumerable <DalComment> GetAllByPredicate(Expression <Func <DalComment, bool> > f)
        {
            var visitor = new HelperExpressionVisitor <DalComment, Comment>(Expression.Parameter(typeof(Comment), f.Parameters[0].Name));
            var exp2    = Expression.Lambda <Func <Comment, bool> >(visitor.Visit(f.Body), visitor.NewParameterExp);
            var x       = context.Set <Comment>().Where(exp2).ToList();

            return(x.Select(u => u.GetDalEntity()));
        }
        public IEnumerable <DALLogin> GetAllByPredicate(Expression <Func <DALLogin, bool> > f)
        {
            var visitor = new HelperExpressionVisitor <DALLogin, Login_Mail>(Expression.Parameter(typeof(Login_Mail), f.Parameters[0].Name));
            var exp2    = Expression.Lambda <Func <Login_Mail, bool> >(visitor.Visit(f.Body), visitor.NewParameterExp);
            var x       = context.Set <Login_Mail>().Where(exp2).ToList();

            return(x.Select(pr => pr.GetDALEntity()));
        }
        public IEnumerable <CommentEntity> GetAllByPredicate(Expression <Func <CommentEntity, bool> > f)
        {
            var visitor = new HelperExpressionVisitor <CommentEntity, DalComment>(Expression.Parameter(typeof(DalComment), f.Parameters[0].Name));
            var exp2    = Expression.Lambda <Func <DalComment, bool> >(visitor.Visit(f.Body), visitor.NewParameterExp);

            //ToList()
            return(commentRepository.GetAllByPredicate(exp2).Select(comment => comment.GetBllEntity()).ToList());
        }
Exemple #7
0
        public IEnumerable <UserEntity> GetAllByPredicate(Expression <Func <UserEntity, bool> > f)
        {
            var visitor = new HelperExpressionVisitor <UserEntity, DalUser>(Expression.Parameter(typeof(DalUser), f.Parameters[0].Name));
            var exp2    = Expression.Lambda <Func <DalUser, bool> >(visitor.Visit(f.Body), visitor.NewParameterExp);

            //ToList()
            return(userRepository.GetAllByPredicate(exp2).Select(user => user.GetBllEntity()).ToList());
        }
        public IEnumerable <DalUser> GetAllByPredicate(Expression <Func <DalUser, bool> > f)
        {
            var visitor = new HelperExpressionVisitor <DalUser, User>(Expression.Parameter(typeof(User), f.Parameters[0].Name));
            var exp2    = Expression.Lambda <Func <User, bool> >(visitor.Visit(f.Body), visitor.NewParameterExp);
            var x       = context.Set <User>().Include(user => user.Roles).Where(exp2).ToList();

            return(x.Select(user => user.GetDalEntity()));
        }
        public IEnumerable <DALSphere> GetAllByPredicate(Expression <Func <DALSphere, bool> > f)
        {
            var visitor =
                new HelperExpressionVisitor <DALSphere, Sphere>(Expression.Parameter(typeof(Sphere), f.Parameters[0].Name));
            var exp2 = Expression.Lambda <Func <Sphere, bool> >(visitor.Visit(f.Body), visitor.NewParameterExp);

            return(context.Set <Sphere>()
                   .Where(exp2)
                   .Select(r => r.GetDALEntity()));
        }
        public IEnumerable <DalRole> GetAllByPredicate(Expression <Func <DalRole, bool> > f)
        {
            var visitor = new HelperExpressionVisitor <DalRole, Role>(Expression.Parameter(typeof(Role), f.Parameters[0].Name));
            var exp2    = Expression.Lambda <Func <Role, bool> >(visitor.Visit(f.Body), visitor.NewParameterExp);

            return(context.Set <Role>()
                   .Where(exp2)
                   .Select(r => new DalRole()
            {
                Id = r.Id,
                Name = r.Name
            }));
        }