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)); }
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)); }
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()); }