public LinkTypeDto FindOne(int linkId)
        {
            var query = (from l in _linkTypeDbProxyRepository.FindAll()
                         let u = l.User
                                 where l.Id == linkId
                                 select CreateLinkTypeDto(l, u));

            return(query.FirstOrDefault());
        }
Beispiel #2
0
 /// <summary>
 /// 获取项目
 /// </summary>
 /// <param name="productId">项目ID</param>
 /// <returns></returns>
 public ProjectDto FindOne(int productId)
 {
     var query = (from p in _projectDbProxyRepository.FindAll()
                  let u = p.User
                  let pt = p.ProjectType
                  where p.Id == productId 
                  select CreateProjectDto(p, u, pt));
     return query.SingleOrDefault();
 }
        /// <summary>
        /// 获取文章标签分页列表
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="pageIndex">开始索引</param>
        /// <param name="pageSize">每页显示条数</param>
        /// <returns></returns>
        public PagedList <ArticleTagDto> FindAllPager(int userId, int pageIndex, int pageSize)
        {
            var query = (from a in _articleTagDbProxyRepository.FindAll()
                         let u = a.User
                                 where u.Id == userId
                                 orderby a.Id descending
                                 select CreateArticleTagDto(a, u));

            return(query.ToPagedList(pageIndex, pageSize));
        }
Beispiel #4
0
        /// <summary>
        /// 查询指定数量的游览过的用户
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="maxIndex">数据大小</param>
        /// <returns></returns>
        public IList <UserTourLogDto> FindToLookTop(int userId, int maxIndex)
        {
            var query = (from q in _userTourLogDbProxyRepository.FindAll()
                         let u = q.User
                                 let uT = q.TourUser
                                          where u.Id == userId
                                          select CreateUserTourLogDto(q, uT));

            return(query.ToList());
        }
Beispiel #5
0
        public IList <AdDto> FindAll(AdType adType, bool?isShow = null)
        {
            var query = _adDbProxyRepositor.FindAll().Where(x => x.AdType == adType);

            if (isShow != null)
            {
                query = query.Where(x => x.IsShow == isShow);
            }
            return(query.OrderByDescending(x => x.Sort).Select(x => CreateAdDto(x)).ToList());
        }
Beispiel #6
0
        /// <summary>
        /// 获取文章留言
        /// </summary>
        /// <param name="articleId">文章ID</param>
        /// <param name="pageIndex">开始页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns></returns>
        public PagedList <ArticleMessageDto> FindAllByArticleIdPager(
            int articleId,
            int pageIndex,
            int pageSize)
        {
            var query = (from a in ArticleDbProxyRepository.FindAll()
                         from m in a.ArticleMessages
                         let u = m.User
                                 where a.Id == articleId &&
                                 a.IsShow
                                 orderby m.CreateDate ascending
                                 select CreateArticleMessageDto(a, m, u));

            return(query.ToPagedList(pageIndex, pageSize));
        }
        public IList <LinkTypeDto> FindAll(int userId, bool?isShow = null, int?linkTypeId = null)
        {
            var query     = _linkTypeDbProxyRepository.FindAll();
            var userQuery = _userDbProxyRepository.FindAll();

            query = query.Join(userQuery, x => x.User.Id, y => y.Id, (x, y) => x);
            query = query.Where(x => x.User.Id == userId);
            if (isShow != null)
            {
                query = query.Where(x => x.IsShow == isShow);
            }
            if (linkTypeId != null)
            {
                query = query.Where(x => x.Id == linkTypeId);
            }
            query = query.OrderByDescending(x => x.Sort);
            var result = query.Select(x => CreateLinkTypeDto(x, x.User));

            return(result.ToList());
        }
Beispiel #8
0
        /// <summary>
        /// 获取指定条数链接列表
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="isShow"></param>
        /// <param name="topIndex"></param>
        /// <returns></returns>
        public IList <LinkDto> GetList(
            int?userId,
            bool?isShow,
            int topIndex)
        {
            var query    = LinkDbProxyRepository.FindAll();
            var user     = UserDbProxyRepository.FindAll();
            var linkType = LinkTypeRepository.FindAll();

            query = query.Join(user, x => x.User.Id, y => y.Id, (x, y) => x);
            query = query.Join(linkType, x => x.LinkType.Id, z => z.Id, (x, z) => x);
            if (userId != null && userId > 0)
            {
                query = query.Where(x => x.User.Id == userId);
            }
            if (isShow != null)
            {
                query = isShow == true?query.Where(x => x.IsShow) : query.Where(x => !x.IsShow);
            }
            query = query.OrderByDescending(x => x.LastDateTime);
            return(query.Select(x => CreateLinkDto(x, x.User, x.LinkType)).ToList());
        }
Beispiel #9
0
        /// <summary>
        /// 获取用户
        /// </summary>
        /// <param name="id">管理员ID</param>
        /// <returns></returns>
        public UserDto FindOne(int id)
        {
            var query = (from user in UserDbProxyRepository.FindAll()
                         where user.Id == id
                         select CreateUserDto(user));

            return(query.SingleOrDefault());
        }
Beispiel #10
0
 /// <summary>
 /// 获取用户项目列表
 /// </summary>
 /// <param name="userId">用户ID</param>
 /// <param name="isShow">前端是否显示</param>
 /// <param name="productTypeId">项目类型ID</param>
 /// <param name="pageIndex">开始页码</param>
 /// <param name="pageSize">页大小</param>
 /// <returns></returns>
 public PagedList<ProjectDto> FindAllPager(int? userId, bool? isShow, int? productTypeId, int pageIndex, int pageSize)
 { 
     // 构造查询关联对象
     var projects = _projectDbProxyRepository.FindAll();
     var users = _userDbProxyRepository.FindAll();
     var projectTyps = _projectTypeDbProxyRepository.FindAll(); 
     var query = projects.Join(users, x => x.User.Id, u => u.Id, (x, u) => x);
     query = query.Join(projectTyps, x => x.ProjectType.Id, t => t.Id, (x, t) => x);
     if(userId!=null)
     { 
         query = query.Where(x => x.User.Id == userId);
     }
     if(productTypeId!=null)
     {
         query = query.Where(x => x.ProjectType.Id == productTypeId);
     }
     if (isShow != null)
     {
         query = isShow == true ? query.Where(x => x.IsShow) : query.Where(x => !x.IsShow);
     }
     query = query.OrderByDescending(x => x.Sort);
     return query.Select(x => CreateProjectDto(x, x.User, x.ProjectType))
            .ToPagedList(pageIndex, pageSize); 
 }
Beispiel #11
0
        /// <summary>
        /// 获取商品类型
        /// </summary>
        /// <returns></returns>
        public DataTable GetAllToDataTable()
        {
            var query = ProductTypeDbProxyRepository.FindAll();

            return(query.Select(CreateProductTypeDto).ToDataTable());
        }