public async Task <IActionResult> Index()
        {
            UserProfileViewModel model = new UserProfileViewModel();
            var allProjects            = _ticketService.GetProjects();

            model.ProjectRoles = (await _projectRolesService.GetUsersWithProjectRoleForUser(User.Identity.Name, allProjects)).ToList();
            model.Tickets      = _ticketService.GetTicketsSmall(User.Identity.Name).ToList();
            model.ApiKeys      = (await _ticketService.GetEnabledApiKeys(User.Identity.Name)).ToList();

            return(View("UserProfile", model));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> UserRoleByUserGet([FromRoute] string userName)
        {
            var keyAuthResult = await _authService.AuthByApiKey();

            if (keyAuthResult.User == null)
            {
                return(BadRequest(ErrorResponse.GetErrorList(keyAuthResult.ErrorText)));
            }

            var projects  = _ticketService.GetProjects();
            var userRoles = await _projectRoleService.GetUsersWithProjectRoleForUser(userName, projects);

            var response = _mapper.Map <List <UserRoleResponse> >(userRoles);

            return(Ok(response));
        }