public IActionResult Index([FromForm] ProviderDetailsVM providerDetails) { ViewBag.Title = _config.Value.SiteTextStrings.SiteTitle; ViewBag.HideSiteTitle = true; //Track that the user came from CQC.org.uk _sessionService.SetRedirectionCookie("true"); var startPage = _config.Value.FormStartPage; if (!string.IsNullOrEmpty(providerDetails.LocationId) && !string.IsNullOrEmpty(providerDetails.ProviderId) && !string.IsNullOrEmpty(providerDetails.LocationName) && !string.IsNullOrEmpty(providerDetails.CookieAccepted)) { _sessionService.SetCookieFlagOnSession(providerDetails.CookieAccepted.ToLower().Trim()); var result = _locationService.GetByIdAsync(providerDetails.LocationId).Result; if (result == null) { _logger.LogError("Error with CQC PayLoad; Provider Information not exist in the system", EnumStatusCode.CQCIntegrationPayLoadNotExist); return(RedirectToAction("StartQuestions", "Home")); } providerDetails.ProviderId = result.ProviderId; providerDetails.LocationName = result.LocationName; return(RedirectToAction("StartQuestions", "Home", routeValues: providerDetails)); } else if (!string.IsNullOrEmpty(providerDetails.CookieAccepted)) { _sessionService.SetCookieFlagOnSession(providerDetails.CookieAccepted.ToLower().Trim()); return(RedirectToAction("StartQuestions", "Home")); } else { _logger.LogError("Error with CQC PayLoad null on the redirection post request", EnumStatusCode.CQCIntegrationPayLoadNullError); _sessionService.SetCookieFlagOnSession("false"); return(RedirectToAction("StartQuestions", "Home", routeValues: providerDetails)); } }
public IActionResult Index([FromForm] ProviderDetailsVM providerDetails) { ViewBag.Title = "Give feedback on care - Care Quality Commission (CQC)"; ViewBag.HideSiteTitle = true; if (!string.IsNullOrEmpty(providerDetails.LocationId) && !string.IsNullOrEmpty(providerDetails.ProviderId) && !string.IsNullOrEmpty(providerDetails.LocationName) && !string.IsNullOrEmpty(providerDetails.CookieAccepted)) { _sessionService.SetCookieFlagOnSession(providerDetails.CookieAccepted.ToLower().Trim()); var result = _locationService.GetByIdAsync(providerDetails.LocationId).Result; if (result == null) { _logger.LogError("Error with CQC PayLoad; Provider Information not exist in the system", EnumStatusCode.CQCIntegrationPayLoadNotExist); return(RedirectToAction("Index", "Search")); } providerDetails.ProviderId = result.ProviderId; providerDetails.LocationName = result.LocationName; return(RedirectToAction("SelectLocation", "Search", routeValues: providerDetails)); } else if (!string.IsNullOrEmpty(providerDetails.CookieAccepted)) { _sessionService.SetCookieFlagOnSession(providerDetails.CookieAccepted.ToLower().Trim()); return(RedirectToAction("Index", "Search")); } else { _logger.LogError("Error with CQC PayLoad null on the redirection post request", EnumStatusCode.CQCIntegrationPayLoadNullError); return(RedirectToAction("Index", "Search")); } }