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"); } }
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); }
public async Task <InvestorDto> GetAsync(Guid userId) { var investor = await _investorRepository.GetAsync(userId); return(_mapper.Map <InvestorDto>(investor)); }