private IActionResult TryCreate(FixtureModelIn input, string sportName)
        {
            IActionResult result;
            ICollection <EncounterDto>      added         = fixtureService.AddFixture(sportName);
            ICollection <EncounterModelOut> addedModelOut = new List <EncounterModelOut>();

            foreach (EncounterDto match in added)
            {
                addedModelOut.Add(factory.CreateModelOut(match));
            }
            result = Created("fixture-generator", addedModelOut);
            return(result);
        }
Example #2
0
        public IActionResult Get([FromQuery] bool grouped)
        {
            ICollection <EncounterDto>      matches = encounterService.GetAllEncounter();
            ICollection <EncounterModelOut> output  = matches.Select(m => factory.CreateModelOut(m)).ToList();
            IActionResult result;

            if (grouped)
            {
                ICollection <EncounterCalendarModelOut> groupedBySportsAndDates = Group(output);
                result = Ok(groupedBySportsAndDates);
            }
            else
            {
                result = Ok(output);
            }
            return(result);
        }