Beispiel #1
0
        public IActionResult GetUser(int userId)
        {
            var user = _repo.GetUser(userId);

            if (user == null)
            {
                return(NotFound());
            }

            return(Ok(ModelsMapping.GetUserDto(user)));
        }
Beispiel #2
0
        public IActionResult GetSubordinates(int userId)
        {
            var users = _repo.GetUsers().Select(ModelsMapping.GetUserDto);

            if (users == null || !users.Any())
            {
                return(NotFound());
            }

            var currentUser = ModelsMapping.GetUserDto(_repo.GetUser(userId));

            if (currentUser == null)
            {
                return(BadRequest());
            }

            var subordinatesIdsList = new List <int>();

            GetSubordinatesIDs(users, subordinatesIdsList, currentUser);

            return(Ok(subordinatesIdsList));
        }
Beispiel #3
0
 public IActionResult GetUsers()
 {
     return(Ok(_repo.GetUsers().Select(o => ModelsMapping.GetUserDto(o))));
 }