Ejemplo n.º 1
0
        public async Task <ChannelDto> GetAsync(Guid id)
        {
            Channel channel = await _channelRepository.Select
                              .IncludeMany(r => r.Tags, r => r.Where(u => u.Status == true))
                              .Where(a => a.Id == id)
                              .WhereCascade(r => r.IsDeleted == false).ToOneAsync();

            ChannelDto channelDto = Mapper.Map <ChannelDto>(channel);

            channelDto.ThumbnailDisplay = _fileRepository.GetFileUrl(channelDto.Thumbnail);
            return(channelDto);
        }
Ejemplo n.º 2
0
        public async Task <PagedResultDto <ChannelDto> > GetListAsync(ChannelSearchDto searchDto)
        {
            List <ChannelDto> channel = (await _channelRepository.Select
                                         .IncludeMany(r => r.Tags, r => r.Where(u => u.Status == true))
                                         .WhereIf(searchDto.ChannelName.IsNotNullOrEmpty(), r => r.ChannelName.Contains(searchDto.ChannelName))
                                         .OrderByDescending(r => r.SortCode)
                                         .OrderBy(r => r.CreateTime)
                                         .ToPagerListAsync(searchDto, out long totalCount))
                                        .Select(r =>
            {
                ChannelDto channelDto       = Mapper.Map <ChannelDto>(r);
                channelDto.ThumbnailDisplay = _fileRepository.GetFileUrl(channelDto.Thumbnail);
                return(channelDto);
            }).ToList();

            return(new PagedResultDto <ChannelDto>(channel, totalCount));
        }