예제 #1
0
        // GET: Applicant/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Applicant applicant = _repository.GetApplicant(id.Value);

            if (applicant == null)
            {
                return(HttpNotFound());
            }
            return(View(applicant));
        }
        public async Task <ActionResult <Applicant> > GetApplicant(int id)
        {
            try
            {
                var result = await applicantRepository.GetApplicant(id);

                if (result == null)
                {
                    return(NotFound());
                }

                return(result);
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, "Accessing database error!"));
            }
        }
        public async Task <ActionResult <Applicant> > GetAplicant(int id)
        {
            try
            {
                Log.Debug($"{Section.GetValue<string>("DebugAPIget")}{nameof(GetAplicant)} - id={id}\nCode: [{Code200}]");
                var result = await applicantRepository.GetApplicant(id);

                if (result == null)
                {
                    Log.Error($"{Section.GetValue<string>("NotFound")}[object={nameof(GetAplicant)}; id={id}]");
                    return(NotFound());
                }
                Log.Information($"[object=Applicant; id={id}] has been retreived\nResult: [{result}]");
                return(result);
            }
            catch (Exception err)
            {
                Log.Error($"Exception occured: [{err}]\nStatusCode:{Code500}");
                return(StatusCode(Code500, Section.GetValue <string>("RetreiveFromDbError")));
            }
        }
예제 #4
0
 public ActionResult <ApplicantDTO> Get(int id)
 {
     try
     {
         var data = _commonrepo.Get(id);
         return(_repo.GetApplicant(id));
     }
     catch (Exception ex)
     {
         _logger.LogInformation($"Failed to get record, Error {ex.Message}");
         return(BadRequest(ex.Message));
     }
 }
예제 #5
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>());
        }
예제 #6
0
        public async Task <IActionResult> GetApplicant(int id)
        {
            var applicant = await _applicantRepository.GetApplicant(id);

            return(Ok(applicant));
        }
예제 #7
0
 public async Task <Core.Applicant.Applicant> GetApplicant(long id)
 {
     return(await _repository.GetApplicant(id));
 }
예제 #8
0
 public List <Applicant> GetApplicant(int ID)
 {
     return(_applicantRepository.GetApplicant(ID));
 }