Esempio n. 1
0
        public async Task <PagedResultDto <QuickLinkWithUserOutputDto> > GetAllList(GetQuickLinkUserListInput input)
        {
            var query = from a in _baserepository.GetAll()
                        join b in _repository.GetAll() on new { Id = a.Id, UserId = AbpSession.UserId.Value } equals new { Id = b.QuickLinkId, UserId = b.UserId } into g
            from c in g.DefaultIfEmpty()
            select new QuickLinkWithUserOutputDto
            {
                Id       = a.Id,
                Name     = a.Name,
                Link     = a.Link,
                Sort     = a.Sort,
                IsSelect = c == null ? false : true
            };

            var toalCount = await query.CountAsync();

            var ret = await query.OrderBy(r => r.Sort).PageBy(input).ToListAsync();

            return(new PagedResultDto <QuickLinkWithUserOutputDto>(toalCount, ret));
        }
Esempio n. 2
0
        public async Task <PagedResultDto <QuickLinkUserListOutputDto> > GetList(GetQuickLinkUserListInput input)
        {
            var query = from a in _repository.GetAll()
                        join b in _baserepository.GetAll() on a.QuickLinkId equals b.Id
                        join c in UserManager.Users on a.UserId equals c.Id
                        where c.Id == AbpSession.UserId
                        select new QuickLinkUserListOutputDto()
            {
                Id           = a.Id,
                QuickLinkId  = a.QuickLinkId,
                UserId       = a.UserId,
                Sort         = a.Sort,
                CreationTime = a.CreationTime,
                Link         = b.Link,
                Name         = b.Name,
            };
            var toalCount = await query.CountAsync();

            var ret = await query.OrderBy(r => r.Sort).PageBy(input).ToListAsync();

            return(new PagedResultDto <QuickLinkUserListOutputDto>(toalCount, ret));
        }