1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-07 21:58:06 -05:00
IW4M-Admin/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs
2024-07-16 22:27:27 +01:00

19 lines
707 B
C#

using System.Linq;
using System.Threading.Tasks;
using Data.Models;
using Microsoft.AspNetCore.Mvc;
namespace IW4MAdmin.WebfrontCore.ViewComponents
{
public class PenaltyListViewComponent : ViewComponent
{
public async Task<IViewComponentResult> InvokeAsync(int offset, int count, EFPenalty.PenaltyType showOnly, bool ignoreAutomated)
{
var penalties = await Program.Manager.GetPenaltyService().GetRecentPenalties(count, offset, showOnly, ignoreAutomated);
penalties = User.Identity.IsAuthenticated ? penalties : penalties.Where(p => !p.Sensitive).ToList();
return View("~/Views/Penalty/PenaltyInfoList.cshtml", penalties);
}
}
}