Beispiel #1
0
        public IActionResult GetUsers()
        {
            string email    = Request.Headers["Email"];
            string password = Request.Headers["Password"];

            if (String.IsNullOrEmpty(email) || String.IsNullOrEmpty(password))
            {
                return(BadRequest(_itemHelper.response(false, 500, "User can not authenticate please check email and password")));
            }

            UserManager user = _userManagerService.AuthenticateUser(email, password);

            if (user == null)
            {
                return(BadRequest(_itemHelper.response(false, 500, "User model is empty")));
            }

            CommonEnum.UserRoleType roletype = (CommonEnum.UserRoleType)Enum.Parse(typeof(CommonEnum.UserRoleType), user.RoleManager.Name);

            if (roletype != CommonEnum.UserRoleType.admin)
            {
                return(BadRequest(_itemHelper.response(false, 500, "You dont have right's to update entries")));
            }

            var userList = _userManagerService.GetAllUsers();

            //var jsonData = JsonConvert.SerializeObject(roleList);

            return(Ok(userList));
        }
Beispiel #2
0
 public IActionResult GetAllUsers()
 {
     try
     {
         var list = _userManagerService.GetAllUsers();
         return(Ok(list));
     }
     catch (Exception e)
     {
         return(StatusCode(500, new { Message = "Server ERROR occured." }));
     }
 }
Beispiel #3
0
        public IResult Users()
        {
            var users = _userManager.GetAllUsers();

            return(users);
        }