Test Creation DesktopApp
This commit is contained in:
@@ -23,19 +23,6 @@ namespace LaDOSE.Api.Controllers
|
||||
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)
|
||||
{
|
||||
return _service.CreateChallonge(eventId, wpEventId);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ namespace LaDOSE.Api.Controllers
|
||||
[HttpPost]
|
||||
public TU Post([FromBody]TU dto)
|
||||
{
|
||||
return _service.Create(dto);
|
||||
return _service.AddOrUpdate(dto);
|
||||
}
|
||||
[HttpGet]
|
||||
public List<TU> Get()
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
using LaDOSE.Business.Interface;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
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();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,20 +11,62 @@ namespace LaDOSE.Api.Controllers
|
||||
[Route("api/[controller]")]
|
||||
public class WordPressController : Controller
|
||||
{
|
||||
public IGameService GameService { get; }
|
||||
private IWordPressService _service;
|
||||
// GET
|
||||
|
||||
public WordPressController(IWordPressService service)
|
||||
public WordPressController(IWordPressService service, IGameService gameService )
|
||||
{
|
||||
GameService = gameService;
|
||||
_service = service;
|
||||
}
|
||||
|
||||
private IWordPressService _service;
|
||||
|
||||
|
||||
[HttpGet("WPEvent")]
|
||||
public List<WPEvent> Event()
|
||||
{
|
||||
return _service.GetWpEvent();
|
||||
var wpEvents = _service.GetWpEvent();
|
||||
foreach (var wpEvent in wpEvents)
|
||||
{
|
||||
|
||||
foreach (var wpEventWpBooking in wpEvent.WPBookings)
|
||||
{
|
||||
wpEventWpBooking.WPEvent = null;
|
||||
wpEventWpBooking.WPUser.WPBookings = null;
|
||||
}
|
||||
}
|
||||
return wpEvents;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("GetUsers/{wpEventId}/{gameId}")]
|
||||
public List<WPUser> GetUsers(int wpEventId, int gameId)
|
||||
{
|
||||
var game = GameService.GetById(gameId);
|
||||
return _service.GetBooking(wpEventId, game);
|
||||
|
||||
}
|
||||
[HttpGet("GetUsersOptions/{wpEventId}/{gameId}")]
|
||||
public List<WPUser> GetUsersOptions(int wpEventId, int gameId)
|
||||
{
|
||||
var game = GameService.GetById(gameId);
|
||||
return _service.GetBookingOptions(wpEventId, game);
|
||||
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("UpdateDb")]
|
||||
public bool UpdateDb()
|
||||
{
|
||||
return _service.UpdateBooking();
|
||||
|
||||
}
|
||||
|
||||
[HttpGet("CreateChallonge/{gameId:int}/{wpEventId:int}")]
|
||||
public bool CreateChallonge(int gameId, int wpEventId)
|
||||
{
|
||||
return _service.CreateChallonge(gameId, wpEventId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,11 @@ namespace LaDOSE.Api
|
||||
|
||||
|
||||
services.AddCors();
|
||||
services.AddMvc().AddJsonOptions(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
|
||||
services.AddMvc().AddJsonOptions(x =>
|
||||
{
|
||||
x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
|
||||
x.SerializerSettings.MaxDepth= 4;
|
||||
});
|
||||
services.AddDbContextPool<LaDOSEDbContext>( // replace "YourDbContext" with the class name of your DbContext
|
||||
options => options.UseMySql($"Server={MySqlServer};Database={MySqlDatabase};User={MySqlUser};Password={MySqlPassword};", // replace with your Connection String
|
||||
mysqlOptions =>
|
||||
@@ -99,7 +103,6 @@ namespace LaDOSE.Api
|
||||
services.AddScoped<IGameService, GameService>();
|
||||
services.AddScoped<IEventService, EventService>();
|
||||
services.AddScoped<ISeasonService, SeasonService>();
|
||||
services.AddScoped<IUtilService, UtilService>();
|
||||
services.AddScoped<IWordPressService, WordPressService>();
|
||||
services.AddTransient<IChallongeProvider>(p => new ChallongeProvider(this.Configuration["ApiKey:ChallongeApiKey"]));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user