Try to parse Php Serialized object.

This commit is contained in:
2018-10-22 01:13:42 +02:00
parent e47c1ccb5e
commit 70d91a84f3
10 changed files with 322 additions and 7 deletions

View File

@@ -4,20 +4,33 @@ using System.Linq;
using System.Threading.Tasks;
using LaDOSE.Business.Interface;
using LaDOSE.Entity;
using LaDOSE.Entity.Wordpress;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace LaDOSE.Api.Controllers
{
[Authorize]
[Produces("application/json")]
[Route("api/[controller]")]
public class EventController : GenericController<IEventService, Event>
{
public EventController(IEventService service) : base(service)
private IGameService _gameService;
public EventController(IEventService service,IGameService gameService) : base(service)
{
this._gameService = gameService;
}
[HttpGet("GetUsers/{eventId}/{wpEventId}/{gameId}")]
public List<WPUser> GetUsers(int eventId, int wpEventId,int gameId)
{
var game = _gameService.GetById(gameId);
return _service.GetBooking(eventId, wpEventId,game);
}
[HttpGet("Generate/{eventId}/{wpEventId}")]
public bool GenerateChallonge(int eventId, int wpEventId)
{
@@ -25,4 +38,26 @@ namespace LaDOSE.Api.Controllers
}
}
[Authorize]
[Produces("application/json")]
[Route("api/[controller]")]
public class UtilController : Controller
{
private IUtilService _service;
public UtilController(IUtilService service)
{
_service = service;
}
[HttpGet("UpdateBooking")]
public bool UpdateBooking()
{
return _service.UpdateBooking();
}
}
}

View File

@@ -42,6 +42,7 @@ namespace LaDOSE.Api
var MySqlUser = this.Configuration["MySql:User"];
var MySqlPassword = this.Configuration["MySql:Password"];
services.AddCors();
services.AddMvc().AddJsonOptions(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
services.AddDbContextPool<LaDOSEDbContext>( // replace "YourDbContext" with the class name of your DbContext
@@ -98,6 +99,7 @@ namespace LaDOSE.Api
services.AddScoped<IGameService, GameService>();
services.AddScoped<IEventService, EventService>();
services.AddScoped<ISeasonService, SeasonService>();
services.AddScoped<IUtilService, UtilService>();
services.AddTransient<IChallongeProvider>(p => new ChallongeProvider(this.Configuration["ApiKey:ChallongeApiKey"]));
}