public async Task <IActionResult> Confirm() { CurrentResponse.Complete(_dateTime.Now); await _surveyResponseRepository.SaveChanges(); _clientStorage.Clear(SurveyResponse.StorageKey); return(RedirectToAction("Done", "Home")); }
public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { if (context.Controller is SurveyController surveyController) { var responseId = _clientStorage.Read(SurveyResponse.StorageKey); surveyController.CurrentResponse = await _surveyResponseRepository.Find(responseId); if (surveyController.CurrentResponse == null) { _clientStorage.Clear(SurveyResponse.StorageKey); context.Result = new RedirectToRouteResult( new RouteValueDictionary(new { controller = "Home", action = "Index" }) ); return; } } await next(); }