public async Task ProcessApplication(CardApplication creditApplication)
        {
            _applicationRepository.InsertApplication(creditApplication);
            await _applicationRepository.Save();



            var availableCards = _cardRepository.GetCards().Result;

            foreach (Card product in availableCards)
            {
                bool acceptance = product.MeetsCriteria(creditApplication, _ageCalculator);

                CardApplicationResult result = new CardApplicationResult(product, creditApplication, acceptance);
                _cardApplicationResultRepository.InsertApplicationResult(result);
            }
            await _cardApplicationResultRepository.Save();

            //set to results complete
            creditApplication.ResultsComplete = true;
            _applicationRepository.UpdateApplication(creditApplication as CardApplication);
            await _applicationRepository.Save();

            //return products.AsEnumerable();
        }
Exemplo n.º 2
0
 public void InsertApplicationResult(CardApplicationResult result)
 {
     _context.CardApplicationResult.Add(result);
 }