public void Add(Applicant newApplicant)
        {
            // set income types
            if (newApplicant.Income > 0 && newApplicant.Income < 300000)
            {
                var incomeType = _context.IncomeTypes.Where(it => it.Name == "LOW").FirstOrDefault();
                newApplicant.IncomeType = (IncomeType)incomeType;
            }
            else if (newApplicant.Income >= 300000 && newApplicant.Income < 600000)
            {
                var incomeType = _context.IncomeTypes.Where(it => it.Name == "Middle").FirstOrDefault();

                newApplicant.IncomeType = (IncomeType)incomeType;
            }
            else
            {
                var incomeType = _context.IncomeTypes.Where(it => it.Name == "High").FirstOrDefault();
                newApplicant.IncomeType = (IncomeType)incomeType;
            }

            // Set credit types

            if (newApplicant.Credit > 0 && newApplicant.Credit <= 550)
            {
                // bad
                newApplicant.CreditScore = _context.CreditScores.Where(cs => cs.Name == "Bad").FirstOrDefault();
            }
            else if (newApplicant.Credit > 550 && newApplicant.Credit <= 699)
            {
                //poor and fair
                newApplicant.CreditScore = _context.CreditScores.Where(cs => cs.Name == "Average").FirstOrDefault();
            }
            else
            {
                newApplicant.CreditScore = _context.CreditScores.Where(cs => cs.Name == "Good").FirstOrDefault();
            }
            _context.Add(newApplicant);
            _context.SaveChanges();
        }
Ejemplo n.º 2
0
 public void Add(Submission newSubmission)
 {
     _context.Submissions.Add(newSubmission);
     _context.SaveChanges();
 }
Ejemplo n.º 3
0
 public void Add(Case newCase)
 {
     _context.Add(newCase);
     _context.SaveChanges();
 }
 public void Add(Status newStatus)
 {
     _context.Add(newStatus);
     _context.SaveChanges();
 }