add ban management page
This commit is contained in:
@ -142,7 +142,7 @@ namespace WebfrontCore.Controllers
|
||||
}));
|
||||
}
|
||||
|
||||
public IActionResult UnbanForm()
|
||||
public IActionResult UnbanForm(long? id)
|
||||
{
|
||||
var info = new ActionInfo
|
||||
{
|
||||
@ -159,6 +159,15 @@ namespace WebfrontCore.Controllers
|
||||
Action = "UnbanAsync",
|
||||
ShouldRefresh = true
|
||||
};
|
||||
if (id is not null)
|
||||
{
|
||||
info.Inputs.Add(new()
|
||||
{
|
||||
Name = "targetId",
|
||||
Value = id.ToString(),
|
||||
Type = "hidden"
|
||||
});
|
||||
}
|
||||
|
||||
return View("_ActionForm", info);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ using SharedLibraryCore;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Interfaces;
|
||||
using System.Threading.Tasks;
|
||||
using WebfrontCore.QueryHelpers.Models;
|
||||
|
||||
namespace WebfrontCore.Controllers
|
||||
{
|
||||
@ -11,12 +12,16 @@ namespace WebfrontCore.Controllers
|
||||
{
|
||||
private readonly IAuditInformationRepository _auditInformationRepository;
|
||||
private readonly ITranslationLookup _translationLookup;
|
||||
private readonly IResourceQueryHelper<BanInfoRequest, BanInfo> _banInfoQueryHelper;
|
||||
private static readonly int DEFAULT_COUNT = 25;
|
||||
|
||||
public AdminController(IManager manager, IAuditInformationRepository auditInformationRepository, ITranslationLookup translationLookup) : base(manager)
|
||||
public AdminController(IManager manager, IAuditInformationRepository auditInformationRepository,
|
||||
ITranslationLookup translationLookup,
|
||||
IResourceQueryHelper<BanInfoRequest, BanInfo> banInfoQueryHelper) : base(manager)
|
||||
{
|
||||
_auditInformationRepository = auditInformationRepository;
|
||||
_translationLookup = translationLookup;
|
||||
_banInfoQueryHelper = banInfoQueryHelper;
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
@ -27,7 +32,7 @@ namespace WebfrontCore.Controllers
|
||||
ViewBag.Title = _translationLookup["WEBFRONT_NAV_AUDIT_LOG"];
|
||||
ViewBag.InitialOffset = DEFAULT_COUNT;
|
||||
|
||||
var auditItems = await _auditInformationRepository.ListAuditInformation(new PaginationRequest()
|
||||
var auditItems = await _auditInformationRepository.ListAuditInformation(new PaginationRequest
|
||||
{
|
||||
Count = DEFAULT_COUNT
|
||||
});
|
||||
@ -41,5 +46,25 @@ namespace WebfrontCore.Controllers
|
||||
var auditItems = await _auditInformationRepository.ListAuditInformation(paginationInfo);
|
||||
return PartialView("_ListAuditLog", auditItems);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> BanManagement([FromQuery] BanInfoRequest request)
|
||||
{
|
||||
var results = await _banInfoQueryHelper.QueryResource(request);
|
||||
|
||||
ViewBag.ClientName = request.ClientName;
|
||||
ViewBag.ClientId = request.ClientId;
|
||||
ViewBag.ClientIP = request.ClientIP;
|
||||
ViewBag.ClientGuid = request.ClientGuid;
|
||||
|
||||
ViewBag.Title = "Ban Management";
|
||||
|
||||
return View(results.Results);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> BanManagementList([FromQuery] BanInfoRequest request)
|
||||
{
|
||||
var results = await _banInfoQueryHelper.QueryResource(request);
|
||||
return PartialView("_BanEntries", results.Results);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user