public async Task <IViewComponentResult> InvokeAsync( Stock stock) { var viewModel = new ValuationViewModel() { PricingResult = stock.PricingResult, Currency = stock.Currency, Id = stock.Id, Hints = _hintAnalyzer.GiveHints(stock.PricingResult) }; return(View(viewModel)); }
public ValuationViewModel GenerateValuationViewModel(ValuationSummary summary, Highcharts chart) { ValuationViewModel model = new ValuationViewModel(); //set the valuation summary model.ValuationSummary = summary; model.Chart = chart; //set the intraday change by getting the last value from the dictionary model.IntradayChange = Math.Round(summary.IntraDayChangeValuationDetailSummary.Values.Last(), 2).ToString(); model.PercentageChange = Math.Round(((summary.IntraDayChangeValuationDetailSummary.Values.Last() / summary.ValuationDetailSummary.Values.Last()) * 100), 2).ToString(); model.PortfolioValue = summary.ValuationDetailSummary.Values.Last().ToString(); model.IntradayHigh = Math.Round(summary.IntraDayChangeValuationDetailSummary.Values.Max(), 2).ToString(); model.IntradayLow = Math.Round(summary.IntraDayChangeValuationDetailSummary.Values.Min(), 2).ToString(); return(model); }