Beispiel #1
0
        public async Task <PagedResultDto <EmailDto> > GetListAsync(GetEmailListDto input)
        {
            if (input.Sorting.IsNullOrWhiteSpace())
            {
                input.Sorting = nameof(Email.EmailString);
            }

            //var emails1 = await _emailRepository.GetListAsync();

            var emails = await _emailRepository.GetListAsync(
                input.SkipCount,
                input.MaxResultCount,
                input.Sorting,
                input.Filter
                );

            var totalCount = input.Filter == null
                ? await _emailRepository.CountAsync()
                : await _emailRepository.CountAsync(email => email.EmailString.Contains(input.Filter));

            return(new PagedResultDto <EmailDto>(
                       totalCount,
                       ObjectMapper.Map <List <Email>, List <EmailDto> >(emails)
                       ));
        }