Пример #1
0
        public IActionResult GetAllRoles()
        {
            var result = _aspNetRolesService.GetAllRoles();

            if (!result.IsSuccess)
            {
                return(BadRequest(result));
            }

            return(Ok(result.Response));
        }
Пример #2
0
        public IActionResult GetAllRoles()
        {
            var Supervisor = new List <AllUserRolesDto>();

            var rolesType  = _aspNetRolesService.GetAllRoles();
            var usersRoles = _aspNetUserRoles.GetAllUserRoles();

            if (!usersRoles.IsSuccess)
            {
                return(BadRequest(usersRoles));
            }

            if (!rolesType.IsSuccess)
            {
                return(BadRequest(rolesType));
            }

            var rolSupervisor = rolesType.Response.FirstOrDefault(x => x.NormalizedName.Equals("SUPERVISOR"));

            Supervisor = usersRoles.Response.FindAll(x => x.RoleId == rolSupervisor.Id);

            return(Ok(Supervisor));
        }