// 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"))); } }
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)); } }
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>()); }
public async Task <IActionResult> GetApplicant(int id) { var applicant = await _applicantRepository.GetApplicant(id); return(Ok(applicant)); }
public async Task <Core.Applicant.Applicant> GetApplicant(long id) { return(await _repository.GetApplicant(id)); }
public List <Applicant> GetApplicant(int ID) { return(_applicantRepository.GetApplicant(ID)); }