public ActionResult ViewAnonymisedTraineeship(string application) { var response = _traineeshipApplicationMediator.View(application); switch (response.Code) { case TraineeshipApplicationMediatorCodes.View.Ok: return(View(response.ViewModel)); case TraineeshipApplicationMediatorCodes.View.LinkExpired: return(View("LinkExpired")); default: throw new InvalidMediatorCodeException(response.Code); } }
public async Task <ActionResult> View(int id) { return(await Task.Run <ActionResult>(() => { var response = _traineeshipApplicationMediator.View(UserContext.CandidateId, id); switch (response.Code) { case TraineeshipApplicationMediatorCodes.View.Error: SetUserMessage(response.Message.Text, response.Message.Level); return RedirectToRoute(CandidateRouteNames.MyApplications); case TraineeshipApplicationMediatorCodes.View.ApplicationNotFound: SetUserMessage(response.Message.Text, response.Message.Level); return RedirectToRoute(CandidateRouteNames.MyApplications); case TraineeshipApplicationMediatorCodes.View.Ok: return View(response.ViewModel); } throw new InvalidMediatorCodeException(response.Code); })); }