1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

continue working on per servver topstats

This commit is contained in:
RaidMax
2019-02-26 21:25:27 -06:00
parent 03c90aeae2
commit 1182b98336
15 changed files with 96 additions and 55 deletions

View File

@ -0,0 +1,28 @@
using IW4MAdmin.Plugins.Stats;
using IW4MAdmin.Plugins.Stats.Helpers;
using Microsoft.AspNetCore.Mvc;
using System.Linq;
using System.Threading.Tasks;
namespace Stats.ViewComponents
{
public class TopPlayersViewComponent : ViewComponent
{
public async Task<IViewComponentResult> InvokeAsync(int count, int offset, long? serverId = null)
{
if (serverId == 0)
{
serverId = null;
}
var server = Plugin.ServerManager.GetServers().FirstOrDefault(_server => _server.EndPoint == serverId);
if (server != null)
{
serverId = await StatManager.GetIdForServer(server);
}
return View("_List", await Plugin.Manager.GetTopStats(offset, count, serverId));
}
}
}