public async Task <IViewComponentResult> InvokeAsync(AppData app) { var stats = await _appService.GetSalesStats(app); var vm = new AppSalesViewModel { App = app, SalesCount = stats.SalesCount, Series = stats.Series }; return(View(vm)); }
public IActionResult AppSales(string appId) { var app = HttpContext.GetAppData(); if (app == null) { return(NotFound()); } app.StoreData = GetCurrentStore(); var vm = new AppSalesViewModel { App = app }; return(ViewComponent("AppSales", new { vm })); }
public async Task <IViewComponentResult> InvokeAsync(AppSalesViewModel vm) { if (vm.App == null) { throw new ArgumentNullException(nameof(vm.App)); } if (vm.InitialRendering) { return(View(vm)); } var stats = await _appService.GetSalesStats(vm.App); vm.SalesCount = stats.SalesCount; vm.Series = stats.Series; return(View(vm)); }