Example #1
0
        public async Task <IEnumerable <Core.Mortgage.Mortgage> > GetQualifiedMortgages(long applicantId, decimal propertyValue,
                                                                                        decimal depositAmount)
        {
            if (_applicantRepository.ApplicantExists(applicantId))
            {
                DateTime today     = DateTime.Now;
                var      applicant = await _applicantRepository.GetApplicant(applicantId);

                TimeSpan age = today - applicant.DateOfBirth;
                if ((age.TotalDays / 365) >= 18)
                {
                    var mortgages = (List <Core.Mortgage.Mortgage>) await _mortgageRepository.GetMortgages();

                    decimal mortgageAmount = propertyValue - depositAmount;
                    int     ltv            = (int)((mortgageAmount / propertyValue) * 100);
                    if (ltv <= 90)
                    {
                        return(mortgages.Where(m => m.LoanToValue >= ltv).ToList());
                    }
                }
            }
            return(new List <Core.Mortgage.Mortgage>());
        }
Example #2
0
 public bool ApplicantExists(long id)
 {
     return(_repository.ApplicantExists(id));
 }
 private bool ApplicantExists(string id)
 {
     return(_context.ApplicantExists(id));
 }