mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-06 18:41:12 +01:00
* Dashboard: Add Point Of Sale data Closes #3675. * LNURL: Add POS redirect URL * POS: Fix invoices link * Fix integration tests * Simplify data aggregation * Improve chart display
36 lines
977 B
C#
36 lines
977 B
C#
using System;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using BTCPayServer.Data;
|
|
using BTCPayServer.Services.Apps;
|
|
using BTCPayServer.Services.Stores;
|
|
using Microsoft.AspNetCore.Identity;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace BTCPayServer.Components.AppTopItems;
|
|
|
|
public class AppTopItems : ViewComponent
|
|
{
|
|
private readonly AppService _appService;
|
|
private readonly StoreRepository _storeRepo;
|
|
|
|
public AppTopItems(AppService appService, StoreRepository storeRepo)
|
|
{
|
|
_appService = appService;
|
|
_storeRepo = storeRepo;
|
|
}
|
|
|
|
public async Task<IViewComponentResult> InvokeAsync(AppData app)
|
|
{
|
|
var entries = Enum.Parse<AppType>(app.AppType) == AppType.Crowdfund
|
|
? await _appService.GetPerkStats(app)
|
|
: await _appService.GetItemStats(app);
|
|
var vm = new AppTopItemsViewModel
|
|
{
|
|
App = app,
|
|
Entries = entries.ToList()
|
|
};
|
|
|
|
return View(vm);
|
|
}
|
|
}
|