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