// public async Task<EmailMessageDto> GetByUserIdAsync (int userId, int emailId) { // // var emailMessage = await _emailMessageRepository.GetByUserIdAsync (userId, emailId); // // var message // // return _mapper.Map<EmailMessageDto> (emailMessages); // var accountData = await _emailAccountRepository.GetByUserIdAndByEmailWithSmtpAsync(userId,). // var emailData = await _emailAccountService. // var sa = await _emailClientAggregate. // } public async Task <IEnumerable <EmailMessageDto> > GetAllForEmailAccountAsync(int emailAccountId) { if (await _emailAccountService.EmailAccountExistAsync(emailAccountId)) { throw new Exception("Email account does not exist."); } var emailMessages = await _emailMessageRepository.GetAllForEmailAccountAsync(emailAccountId); return(_mapper.Map <IEnumerable <EmailMessageDto> > (emailMessages)); }