コード例 #1
0
        public IEnumerable <TeamDTO> GetTeamsByUsername(string user)
        {
            string loggedInUser = User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier)?.Value;
            string loggedInRole = User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.Role)?.Value;

            if (loggedInUser == user || loggedInRole == StaticRoles.Admin)
            {
                return(dbm.FindAllTeamsByUsername(user).Select(x => converter.TeamToDTO(x)).ToList());
            }

            return(new List <TeamDTO>());
        }