IW4M-Admin/WebfrontCore/ViewComponents/PenaltyListViewComponent.cs

19 lines
697 B
C#
Raw Normal View History

2018-02-21 20:29:23 -05:00
using Microsoft.AspNetCore.Mvc;
using System.Linq;
using System.Threading.Tasks;
using Data.Models;
2018-02-21 20:29:23 -05:00
namespace WebfrontCore.ViewComponents
{
public class PenaltyListViewComponent : ViewComponent
{
2022-04-19 19:43:58 -04:00
public async Task<IViewComponentResult> InvokeAsync(int offset, int count, EFPenalty.PenaltyType showOnly, bool ignoreAutomated)
2018-02-21 20:29:23 -05:00
{
2022-04-19 19:43:58 -04:00
var penalties = await Program.Manager.GetPenaltyService().GetRecentPenalties(count, offset, showOnly, ignoreAutomated);
penalties = User.Identity.IsAuthenticated ? penalties : penalties.Where(p => !p.Sensitive).ToList();
2018-03-06 02:22:19 -05:00
return View("~/Views/Penalty/PenaltyInfoList.cshtml", penalties);
2018-02-21 20:29:23 -05:00
}
}
}