2018-02-21 20:29:23 -05:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
2018-10-07 22:34:30 -04:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
2018-04-08 02:44:42 -04:00
|
|
|
|
using SharedLibraryCore;
|
|
|
|
|
using SharedLibraryCore.Dtos;
|
2019-12-02 16:52:36 -05:00
|
|
|
|
using SharedLibraryCore.Interfaces;
|
2018-02-21 20:29:23 -05:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
2021-03-22 12:09:25 -04:00
|
|
|
|
using Data.Abstractions;
|
|
|
|
|
using Data.Models;
|
2018-02-21 20:29:23 -05:00
|
|
|
|
|
|
|
|
|
namespace WebfrontCore.Controllers
|
|
|
|
|
{
|
2018-03-06 02:22:19 -05:00
|
|
|
|
public class PenaltyController : BaseController
|
2018-02-21 20:29:23 -05:00
|
|
|
|
{
|
2020-11-27 22:52:52 -05:00
|
|
|
|
private readonly IDatabaseContextFactory _contextFactory;
|
|
|
|
|
|
|
|
|
|
public PenaltyController(IManager manager, IDatabaseContextFactory contextFactory) : base(manager)
|
2019-12-02 16:52:36 -05:00
|
|
|
|
{
|
2020-11-27 22:52:52 -05:00
|
|
|
|
_contextFactory = contextFactory;
|
2019-12-02 16:52:36 -05:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-22 12:09:25 -04:00
|
|
|
|
public IActionResult List(EFPenalty.PenaltyType showOnly = EFPenalty.PenaltyType.Any, bool hideAutomatedPenalties = true)
|
2018-02-21 20:29:23 -05:00
|
|
|
|
{
|
2021-01-08 20:21:23 -05:00
|
|
|
|
ViewBag.Description = Localization["WEBFRONT_DESCRIPTION_PENALTIES"];
|
2018-05-05 18:52:04 -04:00
|
|
|
|
ViewBag.Title = Localization["WEBFRONT_PENALTY_TITLE"];
|
2021-01-08 20:21:23 -05:00
|
|
|
|
ViewBag.Keywords = Localization["WEBFRONT_KEYWORDS_PENALTIES"];
|
2020-02-12 14:13:59 -05:00
|
|
|
|
ViewBag.HideAutomatedPenalties = hideAutomatedPenalties;
|
2018-03-13 17:30:22 -04:00
|
|
|
|
|
2019-05-02 23:33:38 -04:00
|
|
|
|
return View(showOnly);
|
2018-02-21 20:29:23 -05:00
|
|
|
|
}
|
|
|
|
|
|
2022-04-19 19:43:58 -04:00
|
|
|
|
public async Task<IActionResult> ListAsync(int offset = 0, int count = 30, EFPenalty.PenaltyType showOnly = EFPenalty.PenaltyType.Any, bool hideAutomatedPenalties = true)
|
2018-02-21 20:29:23 -05:00
|
|
|
|
{
|
2022-04-19 19:43:58 -04:00
|
|
|
|
return await Task.FromResult(View("_List", new ViewModels.PenaltyFilterInfo
|
2018-05-04 00:22:10 -04:00
|
|
|
|
{
|
|
|
|
|
Offset = offset,
|
2022-04-19 19:43:58 -04:00
|
|
|
|
Count = count,
|
2020-02-12 14:13:59 -05:00
|
|
|
|
ShowOnly = showOnly,
|
|
|
|
|
IgnoreAutomated = hideAutomatedPenalties
|
2018-05-04 00:22:10 -04:00
|
|
|
|
}));
|
2018-02-21 20:29:23 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|