2018-02-21 20:29:23 -05:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
2021-03-22 12:09:25 -04:00
|
|
|
|
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);
|
2019-03-31 20:56:31 -04:00
|
|
|
|
penalties = User.Identity.IsAuthenticated ? penalties : penalties.Where(p => !p.Sensitive).ToList();
|
2018-03-06 02:22:19 -05:00
|
|
|
|
|
2020-11-12 21:39:56 -05:00
|
|
|
|
return View("~/Views/Penalty/PenaltyInfoList.cshtml", penalties);
|
2018-02-21 20:29:23 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|