public async Task <IActionResult> GetApplicantDetails(long applicantId) { if (!ModelState.IsValid) { return(ApiValidationError()); } var getApplicant = new GetApplicantQuery(applicantId); var applicant = await getApplicant.ExecuteAsync(); if (applicant == null) { return(ApiValidationError(new [] { "Invalid Applicant ID specified" })); } return(Ok(applicant)); }
public async Task <IActionResult> GetMortgageProductsForApplicant(long applicantId, [FromBody] MortgageProductQueryRequestModel model) { if (!ModelState.IsValid) { return(ApiValidationError()); } var getApplicantCommand = new GetApplicantQuery(applicantId); var applicant = await getApplicantCommand.ExecuteAsync(); if (applicant == null) { return(ApiValidationError(new [] { "Invalid Applicant ID specified" })); } var getMortgageProductsCommand = new GetMortgageProductsForApplicantQuery(applicant, model.PropertyValue, model.DepositAmount); var mortgageProducts = await getMortgageProductsCommand.ExecuteAsync(); return(Ok(mortgageProducts)); }