我试图从我的RoleManager中删除一个角色,我得到了错误
无法删除该对象,因为在ObjectStateManager中找不到该对象.
我的控制器
[HttpPost]
public void DeleteRole(string RoleName)
{
var RoleMan = new RoleManager<IdentityRole>(new RoleStore<IdentityRole>(new ApplicationDbContext()));
IdentityRole Role = new IdentityRole();
Role.Name = RoleName;
RoleMan.Delete(Role);
}
Run Code Online (Sandbox Code Playgroud) model-view-controller asp.net-mvc asp.net-mvc-4 asp.net-identity