Quick and Dirty Tournament Result / List

This commit is contained in:
2019-05-30 00:42:12 +02:00
parent 9b148fa571
commit 102a6af8e0
14 changed files with 407 additions and 37 deletions

View File

@@ -13,13 +13,12 @@ namespace LaDOSE.Api.Controllers
[Route("api/[controller]")]
public class TournamentController : Controller
{
public IGameService GameService { get; }
private IWordPressService _service;
private ITournamentService _service;
// GET
public TournamentController(IWordPressService service, IGameService gameService)
public TournamentController(ITournamentService service)
{
GameService = gameService;
_service = service;
}
@@ -29,6 +28,21 @@ namespace LaDOSE.Api.Controllers
var tournaments = await _service.GetTournaments(DateTime.Now.AddMonths(-2), null);
return AutoMapper.Mapper.Map<List<TournamentDTO>>(tournaments);
return null;
}
[HttpPost("GetResults")]
public async Task<TournamentsResultDTO> GetResults([FromBody] List<int> ids)
{
if (ids == null)
{
throw new Exception("Invalid arguments");
}
var tournamentsResult = await _service.GetTournamentsResult(ids);
return AutoMapper.Mapper.Map<TournamentsResultDTO>(tournamentsResult);
}
}
}

View File

@@ -119,11 +119,15 @@ namespace LaDOSE.Api
cfg.CreateMap<WPUser, LaDOSE.DTO.WPUserDTO>();
cfg.CreateMap<WPUser, LaDOSE.DTO.WPUserDTO>();
cfg.CreateMap<WPEvent, LaDOSE.DTO.WPEventDTO>();
cfg.CreateMap<Result, LaDOSE.DTO.ResultDTO>();
cfg.CreateMap<TournamentsResult, LaDOSE.DTO.TournamentsResultDTO>();
cfg.CreateMap<Participent, LaDOSE.DTO.ParticipentDTO>();
cfg.CreateMap<Tournament, LaDOSE.DTO.TournamentDTO>();
cfg.CreateMap<ApplicationUser, LaDOSE.DTO.ApplicationUserDTO>();
cfg.CreateMap<WPBooking, LaDOSE.DTO.WPBookingDTO>().ForMember(e=>e.Meta,opt=>opt.MapFrom(s=>s.Meta.CleanWpMeta()));
cfg.CreateMapTwoWay<Game, LaDOSE.DTO.GameDTO>();
cfg.CreateMapTwoWay<Participent, LaDOSE.DTO.ParticipentDTO>();
cfg.CreateMapTwoWay<Tournament, LaDOSE.DTO.TournamentDTO>();
cfg.CreateMapTwoWay<Todo, LaDOSE.DTO.TodoDTO>();
});
@@ -139,6 +143,7 @@ namespace LaDOSE.Api
services.AddScoped<ISeasonService, SeasonService>();
services.AddScoped<IWordPressService, WordPressService>();
services.AddScoped<ITodoService, TodoService>();
services.AddScoped<ITournamentService, TournamentService>();
}