public async Task <ActionResult> BargainFinderMax(BargainFinderMaxPostRQ requestModel) { IActivity activity = new BargainFinderMaxActivity(RestClientFactory.Create(), requestModel); Workflow workflow = new Workflow(activity); SharedContext sharedContext = await workflow.RunAsync(); BargainFinderMaxVM model = ViewModelFactory.CreateBargainFinderMaxVM(sharedContext); return(this.View(model)); }
/// <summary> /// Creates the view model for BargainFinderMax result. /// </summary> /// <param name="sharedContext">The shared context.</param> /// <returns>The view model</returns> public static BargainFinderMaxVM CreateBargainFinderMaxVM(SharedContext sharedContext) { BargainFinderMaxVM viewModel = new BargainFinderMaxVM { RequestUrl = sharedContext.GetResult <string>(BargainFinderMaxActivity.RequestUrlSharedContextKey), RequestJson = sharedContext.GetResult <string>(BargainFinderMaxActivity.RequestJsonSharedContextKey), }; if (sharedContext.IsFaulty) { viewModel.ErrorMessage = sharedContext.GetResult <string>(BargainFinderMaxActivity.SharedContextKey) ?? string.Empty; } else { object result = sharedContext.GetResult(BargainFinderMaxActivity.SharedContextKey); viewModel.ResponseJson = sharedContext.GetResult <string>(BargainFinderMaxActivity.ResponseJsonSharedContextKey); viewModel.ResponseDotNet = ObjectPrinter.CreateString(result); viewModel.ErrorMessage = string.Empty; } return(viewModel); }