示例#1
0
        private async Task ValidateMessage(TransactionMessage msg)
        {
            if (string.IsNullOrEmpty(msg.UniqueId))
            {
                throw new InvalidOperationException($"UniqueId can not be empty");
            }

            if (string.IsNullOrEmpty(msg.Email))
            {
                throw new InvalidOperationException($"Email can not be empty");
            }

            var investor = await _investorRepository.GetAsync(msg.Email);
            if (investor == null)
            {
                throw new InvalidOperationException($"Investor with email {msg.Email} was not found");
            }            
        }
示例#2
0
        public static async Task <Investor> GetInvestorOrFailAsync(
            this IInvestorRepository repository, Guid userId)
        {
            var investor = await repository.GetAsync(userId);

            if (investor == null)
            {
                throw new InvestorNotFoundSerExc($"Investor with user id: '{userId}' was not found.");
            }

            return(investor);
        }
示例#3
0
        public async Task <InvestorDto> GetAsync(Guid userId)
        {
            var investor = await _investorRepository.GetAsync(userId);

            return(_mapper.Map <InvestorDto>(investor));
        }