2018-02-21 20:29:23 -05:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2018-04-13 02:32:30 -04:00
|
|
|
|
using SharedLibraryCore.Objects;
|
2018-02-21 20:29:23 -05:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace WebfrontCore.ViewComponents
|
|
|
|
|
{
|
|
|
|
|
public class PenaltyListViewComponent : ViewComponent
|
|
|
|
|
{
|
2019-03-31 20:56:31 -04:00
|
|
|
|
private const int PENALTY_COUNT = 15;
|
|
|
|
|
|
2018-05-04 00:22:10 -04:00
|
|
|
|
public async Task<IViewComponentResult> InvokeAsync(int offset, Penalty.PenaltyType showOnly)
|
2018-02-21 20:29:23 -05:00
|
|
|
|
{
|
2019-03-31 20:56:31 -04:00
|
|
|
|
var penalties = await Program.Manager.GetPenaltyService().GetRecentPenalties(PENALTY_COUNT, offset, showOnly);
|
|
|
|
|
penalties = User.Identity.IsAuthenticated ? penalties : penalties.Where(p => !p.Sensitive).ToList();
|
2018-03-06 02:22:19 -05:00
|
|
|
|
|
2019-03-31 20:56:31 -04:00
|
|
|
|
return View("_List", penalties);
|
2018-02-21 20:29:23 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|