mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
ban/unban buttons added to profile
several css tweaks changed administratorIPs to PrivilegedClients added time step references to profile page
This commit is contained in:
75
WebfrontCore/Controllers/ActionController.cs
Normal file
75
WebfrontCore/Controllers/ActionController.cs
Normal file
@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibrary;
|
||||
using WebfrontCore.ViewModels;
|
||||
|
||||
namespace WebfrontCore.Controllers
|
||||
{
|
||||
public class ActionController : BaseController
|
||||
{
|
||||
public IActionResult BanForm()
|
||||
{
|
||||
var info = new ActionInfo()
|
||||
{
|
||||
ActionButtonLabel = "Ban",
|
||||
Name = "Ban",
|
||||
Inputs = new List<InputInfo>()
|
||||
{
|
||||
new InputInfo()
|
||||
{
|
||||
Name = "Reason",
|
||||
Placeholder = ""
|
||||
}
|
||||
},
|
||||
Action = "BanAsync"
|
||||
};
|
||||
|
||||
return View("_ActionForm", info);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> BanAsync(int targetId, string Reason)
|
||||
{
|
||||
var server = Manager.GetServers().First();
|
||||
|
||||
return await Task.FromResult(RedirectToAction("ExecuteAsync", "Console", new
|
||||
{
|
||||
serverId = server.GetHashCode(),
|
||||
command = $"!ban @{targetId} {Reason}"
|
||||
}));
|
||||
}
|
||||
|
||||
public IActionResult UnbanForm()
|
||||
{
|
||||
var info = new ActionInfo()
|
||||
{
|
||||
ActionButtonLabel = "Unban",
|
||||
Name = "Unban",
|
||||
Inputs = new List<InputInfo>()
|
||||
{
|
||||
new InputInfo()
|
||||
{
|
||||
Name = "Reason",
|
||||
Placeholder = ""
|
||||
}
|
||||
},
|
||||
Action = "UnbanAsync"
|
||||
};
|
||||
|
||||
return View("_ActionForm", info);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> UnbanAsync(int targetId, string Reason)
|
||||
{
|
||||
var server = Manager.GetServers().First();
|
||||
|
||||
return await Task.FromResult(RedirectToAction("ExecuteAsync", "Console", new
|
||||
{
|
||||
serverId = server.GetHashCode(),
|
||||
command = $"!unban @{targetId} {Reason}"
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user