Hi, i'm using asp.net mvc 5, I got 4 roles and some users in my database, there are 2 roles of them called purchase (name: PURCHASE) and production (name: PRODUCTION).
If a user got 3 roles (purchase, production, sales), when I try to remove this user from purchase role.....it was always successful.
but the result is, production role removed this user, and purchase not......, I tried so many times in multiple ways, it aways has the same result....
is this a bug, or there is really something wrong with my code....
here is my code:
[HttpPut] [Route("api/User/RemoveFromRole/{roleName}/{userId}")] public async Task<IHttpActionResult> RemoveFromRole(string roleName, string userId) { if (roleName == UserConstant.AdminRoleName) { var user = await _userManager.FindByIdAsync(userId); if (user.UserName == "admin") { return BadRequest("Cannot Remove Admin!"); } } await _userManager.RemoveFromRoleAsync(userId, roleName); return Ok(); }