示例#1
0
        public Team GetTeamById(int id)
        {
            var item = teamsRepository.GetTeam(id);

            if (item == null)
            {
                throw new ObjectNotFoundException(string.Format("Team with id '{0}' not found", id));
            }
            return(item);
        }
示例#2
0
        public IActionResult GetTeam(int teamId)
        {
            try
            {
                var team = _teamRepository.GetTeam(teamId);

                if (team == null)
                {
                    return(StatusCode(StatusCodes.Status404NotFound, $"Team with Id {teamId} doesn't exists"));
                }

                return(Ok(team));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, ex.ToString()));
            }
        }
示例#3
0
        public async Task <BL.Models.Team> GetTeam(int id)
        {
            var team = await _teamsRepository.GetTeam(id);

            return(team);
        }
示例#4
0
 public Team GetTeam(int id)
 {
     return(_teamsRepository.GetTeam(id));
 }