Role does not exist

Asjad Butt 71 Reputation points
2022-10-24T10:42:13.307+00:00

HI im trying to make the edit role functionallity keeping it short when i run the controller i get the error
System.InvalidOperationException: Role ADMIN does not exist.
at Microsoft.AspNetCore.Identity.EntityFrameworkCore.UserStore9.AddToRoleAsync(TUser user, String normalizedRoleName, CancellationToken cancellationToken) at Microsoft.AspNetCore.Identity.UserManager1.AddToRolesAsync(TUser user, IEnumerable`1 roles)
at IslamicSchool.Controllers.DeanController.EditRoles(String username, String roles) in D:\IslamicSchool\API\IslamicSchool\IslamicSchool\Controllers\DeanController.cs:line 47

ill attach the controller method as a picture
253534-image.png
also the postman error
253428-image.png

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,162 questions
0 comments No comments
{count} votes

Accepted answer
  1. AgaveJoe 26,201 Reputation points
    2022-10-24T11:06:25.53+00:00

    The error indicates the ADMIN role does not exist in the Role table. Add the role.


0 additional answers

Sort by: Most helpful