public IActionResult GetAvailableProducts(int applicantId, double propertyValue, double depositAmount) { var products = _productRepository.GetAvailableProducts(applicantId, propertyValue, depositAmount); if (HttpContext.Request.ContentType == "application/json") { return(Json(products)); } else { AvailableProductsViewModel availableProductsViewModel = new AvailableProductsViewModel(); availableProductsViewModel.Products = products; availableProductsViewModel.FirstName = _applicantRepository.GetApplicantFirstName(applicantId); return(View("AvailableProducts", availableProductsViewModel)); } }