Ejemplo n.º 1
0
        public async Task <IActionResult> GetTeam(int id)
        {
            var team = await _repository.GetTeam(id);

            if (team == null)
            {
                return(BadRequest("Team does not exist"));
            }
            return(Ok(team));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> GetFixture(int teamId, int fixtureId)
        {
            var teamFromRepo = await _repository.GetTeam(teamId);

            if (teamFromRepo == null)
            {
                return(BadRequest("Team does not exist"));
            }
            var fixtureFromRepo = await _repository.GetFixture(fixtureId);

            if (fixtureFromRepo == null)
            {
                return(BadRequest("Fixture does not exist"));
            }
            var fixtureToReturn = _mapper.Map <FixtureToReturn>(fixtureFromRepo);

            return(Ok(fixtureToReturn));
        }