Пример #1
0
        public IHttpActionResult GetUser(int id)
        {
            var auth = new CustomAuthentication(ControllerContext);

            if (!auth.AuthenticateUser(User.Identity as ClaimsIdentity, id, out IHttpActionResult result))
            {
                return(result);
            }
            var user = _userManager.GetUser(id);

            return(Ok(user));
        }
Пример #2
0
        public IHttpActionResult UpdateUser(int id, UserDisplayDto user)
        {
            //authentication
            var auth = new CustomAuthentication(ControllerContext);

            if (!auth.AuthenticateUser(User.Identity as ClaimsIdentity, id, out IHttpActionResult result))
            {
                return(result);
            }

            var updatedUser = _userManager.UpdateUser(id, user);

            return(Ok(updatedUser));
        }
Пример #3
0
        public IHttpActionResult DeleteUser(int id)
        {
            //authentication
            var auth = new CustomAuthentication(ControllerContext);

            if (!auth.AuthenticateUser(User.Identity as ClaimsIdentity, id, out IHttpActionResult result))
            {
                return(result);
            }

            bool deleted = _userManager.DeleteUser(id);

            if (deleted)
            {
                return(Ok("deleted"));
            }
            return(Ok());
        }