Example #1
0
        public void LeagueGenerationTest()
        {
            Amabra.Database.AmabraContext Context = null;
            EditionService Service = new EditionService(Context);
            Edition        edition = new Edition();

            edition.Tournement               = new Tournement();
            edition.Teams                    = new List <Team>();
            edition.Tournement.Type          = "league";
            edition.Tournement.numberOfTeams = 10;
            for (var i = 0; i < 10; i++)
            {
                edition.Teams.Add(new Team(i.ToString()));
            }
            Service.Generate(edition);
        }
        public async Task <IActionResult> GenerateEdition([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var edition = await _context.Editions.FindAsync(id);

            if (edition == null)
            {
                return(NotFound());
            }

            _editionService.Generate(edition);

            return(Ok(""));
        }