public async Task <IEnumerable <CreditAccountStateDto> > HandleAsync(CreditAccountStatesQuery query) { var creditAccount = await ModelsDao.FindAsync(query.CreditAccountId); return(creditAccount?.CreditAccountStates.MapTo <CreditAccountStateDto>() ?? Enumerable.Empty <CreditAccountStateDto>()); }
public IEnumerable <CreditAccountStateDto> Handle(CreditAccountStatesQuery query) { var creditAccount = ModelsDao.Find(query.CreditAccountId); return(creditAccount?.CreditAccountStates.MapTo <CreditAccountStateDto>() ?? Enumerable.Empty <CreditAccountStateDto>()); }
public async Task <CreditAccountStateDto> HandleAsync(ActualCreditAccountStateQuery query) { CreditAccountModel creditAccount = null; if (query.Id.HasValue) { creditAccount = await ModelsDao.FindAsync(query.Id.Value); } if (!string.IsNullOrEmpty(query.AgreementNumber)) { creditAccount = await ModelsDao.FirstOrDefaultAsync(u => u.CreditAgreementNumber == query.AgreementNumber); } if (creditAccount == null) { return(null); } var creditAccountStatesQuery = new CreditAccountStatesQuery { CreditAccountId = creditAccount.Id }; var latestCreditAccountState = await HandleAsync(creditAccountStatesQuery); return(latestCreditAccountState.OrderBy(s => s.Month).LastOrDefault()); }
public async Task <ListQueryResult <CreditAccountStateViewModel> > GetAccountStatesAsync( CreditAccountStatesQuery query) { return((await RunListQueryAsync <CreditAccountStatesQuery, CreditAccountStateDto>(_queryRepository, query)) .MapTo <CreditAccountStateViewModel>()); }
public ListQueryResult <CreditAccountStateViewModel> GetAccountStates(CreditAccountStatesQuery query) { return(RunListQuery <CreditAccountStatesQuery, CreditAccountStateDto>(_queryRepository, query) .MapTo <CreditAccountStateViewModel>()); }
public async Task <ListQueryResult <CreditAccountStateDto> > GetAccountStateDtosAsync( CreditAccountStatesQuery query) { return(await RunListQueryAsync <CreditAccountStatesQuery, CreditAccountStateDto>(_queryRepository, query)); }
public ListQueryResult <CreditAccountStateDto> GetAccountStateDtos(CreditAccountStatesQuery query) { return(RunListQuery <CreditAccountStatesQuery, CreditAccountStateDto>(_queryRepository, query)); }