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
RaidMax 8a7c4e4cf0 refine webfront pages
finish refactor of penalty information/profile
optimize pull penalty query
start impl of quick message mapping
2019-03-31 19:56:31 -05:00

21 lines
681 B
C#

using Microsoft.AspNetCore.Mvc;
using SharedLibraryCore.Objects;
using System.Linq;
using System.Threading.Tasks;
namespace WebfrontCore.ViewComponents
{
public class PenaltyListViewComponent : ViewComponent
{
private const int PENALTY_COUNT = 15;
public async Task<IViewComponentResult> InvokeAsync(int offset, Penalty.PenaltyType showOnly)
{
var penalties = await Program.Manager.GetPenaltyService().GetRecentPenalties(PENALTY_COUNT, offset, showOnly);
penalties = User.Identity.IsAuthenticated ? penalties : penalties.Where(p => !p.Sensitive).ToList();
return View("_List", penalties);
}
}
}