public async Task <ActionResult> CandidateApplicationFeedback(int id) { return(await Task.Run <ActionResult>(() => { var response = _apprenticeshipApplicationMediator.CandidateApplicationFeedback(UserContext.CandidateId, id); switch (response.Code) { case ApprenticeshipApplicationMediatorCodes.View.Error: SetUserMessage(response.Message.Text, response.Message.Level); return RedirectToRoute(CandidateRouteNames.MyApplications); case ApprenticeshipApplicationMediatorCodes.View.ApplicationNotFound: SetUserMessage(response.Message.Text, response.Message.Level); return RedirectToRoute(CandidateRouteNames.MyApplications); case ApprenticeshipApplicationMediatorCodes.View.Ok: return View(response.ViewModel); } throw new InvalidMediatorCodeException(response.Code); })); }