Пример #1
0
        public async Task <IActionResult> GetTeam(string id)
        {
            var team = await teamProvider.GetTeam(id);

            if (team == null)
            {
                return(NotFound());
            }
            var teamViewModel = mapper.Map <TeamViewModel>(team);

            return(Ok(teamViewModel));
        }
        public Team GetTeam(ITeamProvider tp)
        {
            var claim = GetCurrentClaims().FirstOrDefault(x => x.Type == ClaimTypes.System);

            if (claim?.Value == null)
            {
                throw new ArgumentException("Could not find Team in Claims");
            }
            ;

            var values = JsonConvert.DeserializeObject <int[]>(claim.Value);

            if (values == null || values.Length == 0)
            {
                throw new ArgumentException("Could not find Team in Claims");
            }
            if (values.Length > 1)
            {
                throw new ArgumentException("User have more than one team in claims. Application does not support this yet");
            }

            return(tp.GetTeam(values[0]));
        }
Пример #3
0
 public Team GetProject(ITeamProvider tp)
 {
     return(tp.GetTeam(TeamProjectInt));
 }