migrating to .NET Core 2.0
This commit is contained in:
@ -1,8 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
using WebfrontCore.Application.API;
|
||||
|
||||
namespace WebfrontCore.Controllers.API
|
||||
@ -14,7 +13,7 @@ namespace WebfrontCore.Controllers.API
|
||||
public ActionResult Index()
|
||||
{
|
||||
var events = EventAPI.Events;
|
||||
var eventsDto = new List<SharedLibrary.Dtos.EventInfo>();
|
||||
var eventsDto = new List<EventInfo>();
|
||||
while (events.Count > 0)
|
||||
eventsDto.Add(events.Dequeue());
|
||||
return Json(eventsDto);
|
||||
|
@ -3,6 +3,7 @@ using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using System.Security.Claims;
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
|
||||
namespace WebfrontCore.Controllers
|
||||
{
|
||||
@ -19,7 +20,7 @@ namespace WebfrontCore.Controllers
|
||||
try
|
||||
{
|
||||
var client = IW4MAdmin.Program.ServerManager.PrivilegedClients[clientId];
|
||||
string[] hashedPassword = await Task.FromResult(SharedLibrary.Helpers.Hashing.Hash(password, client.PasswordSalt));
|
||||
string[] hashedPassword = await Task.FromResult(SharedLibraryCore.Helpers.Hashing.Hash(password, client.PasswordSalt));
|
||||
|
||||
if (hashedPassword[0] == client.Password)
|
||||
{
|
||||
@ -32,7 +33,7 @@ namespace WebfrontCore.Controllers
|
||||
|
||||
var claimsIdentity = new ClaimsIdentity(claims, "login");
|
||||
var claimsPrinciple = new ClaimsPrincipal(claimsIdentity);
|
||||
await HttpContext.Authentication.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, claimsPrinciple, new Microsoft.AspNetCore.Http.Authentication.AuthenticationProperties()
|
||||
await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, claimsPrinciple, new AuthenticationProperties()
|
||||
{
|
||||
AllowRefresh = true,
|
||||
ExpiresUtc = DateTime.UtcNow.AddDays(30),
|
||||
@ -55,7 +56,7 @@ namespace WebfrontCore.Controllers
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> LogoutAsync()
|
||||
{
|
||||
await HttpContext.Authentication.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
|
||||
return RedirectToAction("Index", "Home");
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibrary;
|
||||
using SharedLibraryCore;
|
||||
using WebfrontCore.ViewModels;
|
||||
|
||||
namespace WebfrontCore.Controllers
|
||||
|
@ -1,9 +1,10 @@
|
||||
using IW4MAdmin;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using SharedLibrary;
|
||||
using SharedLibrary.Database.Models;
|
||||
using SharedLibrary.Objects;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Database;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using SharedLibraryCore.Objects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -14,9 +15,15 @@ namespace WebfrontCore.Controllers
|
||||
public class BaseController : Controller
|
||||
{
|
||||
protected ApplicationManager Manager;
|
||||
protected readonly DatabaseContext Context;
|
||||
protected bool Authorized { get; private set; }
|
||||
protected EFClient User { get; private set; }
|
||||
|
||||
/* public BaseController(DatabaseContext ctx)
|
||||
{
|
||||
Context = ctx;
|
||||
}*/
|
||||
|
||||
public override void OnActionExecuting(ActionExecutingContext context)
|
||||
{
|
||||
Manager = IW4MAdmin.Program.ServerManager;
|
||||
|
@ -1,7 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibrary;
|
||||
using SharedLibrary.Dtos;
|
||||
using SharedLibrary.Services;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Database;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -14,6 +15,7 @@ namespace WebfrontCore.Controllers
|
||||
public async Task<IActionResult> ProfileAsync(int id)
|
||||
{
|
||||
var client = await Manager.GetClientService().Get(id);
|
||||
|
||||
var clientDto = new PlayerInfo()
|
||||
{
|
||||
Name = client.Name,
|
||||
@ -46,7 +48,7 @@ namespace WebfrontCore.Controllers
|
||||
var administeredPenaltiesMeta = await Manager.GetPenaltyService()
|
||||
.ReadGetClientPenaltiesAsync(client.ClientId, false);
|
||||
|
||||
if (Authorized && client.Level > SharedLibrary.Objects.Player.Permission.Trusted)
|
||||
if (Authorized && client.Level > SharedLibraryCore.Objects.Player.Permission.Trusted)
|
||||
clientDto.Meta.Add(new ProfileMeta()
|
||||
{
|
||||
Key = "Masked",
|
||||
@ -91,7 +93,7 @@ namespace WebfrontCore.Controllers
|
||||
var admins = (await Manager.GetClientService().GetPrivilegedClients())
|
||||
.Where(a => a.Active)
|
||||
.OrderByDescending(a => a.Level);
|
||||
var adminsDict = new Dictionary<SharedLibrary.Objects.Player.Permission, IList<ClientInfo>>();
|
||||
var adminsDict = new Dictionary<SharedLibraryCore.Objects.Player.Permission, IList<ClientInfo>>();
|
||||
|
||||
foreach (var admin in admins)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibrary;
|
||||
using SharedLibrary.Dtos;
|
||||
using SharedLibrary.Objects;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Objects;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -4,7 +4,7 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibrary.Dtos;
|
||||
using SharedLibraryCore.Dtos;
|
||||
|
||||
namespace WebfrontCore.Controllers
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibrary;
|
||||
using SharedLibrary.Database.Models;
|
||||
using SharedLibrary.Dtos;
|
||||
using SharedLibrary.Services;
|
||||
using SharedLibraryCore;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using SharedLibraryCore.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -30,7 +30,7 @@ namespace WebfrontCore.Controllers
|
||||
public async Task<IActionResult> PublicAsync()
|
||||
{
|
||||
var penalties = await (new GenericRepository<EFPenalty>())
|
||||
.FindAsync(p => p.Type == SharedLibrary.Objects.Penalty.PenaltyType.Ban && p.Active);
|
||||
.FindAsync(p => p.Type == SharedLibraryCore.Objects.Penalty.PenaltyType.Ban && p.Active);
|
||||
|
||||
var penaltiesDto = penalties.Select(p => new PenaltyInfo()
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SharedLibrary.Dtos;
|
||||
using SharedLibraryCore.Dtos;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
Reference in New Issue
Block a user