Пример #1
0
        public async Task<IdentityResult> CreateRoleAsync()
        {
            var context = new ApplicationDbContext();

            var roleManager = new RoleManager<IdentityRole>(new RoleStore<IdentityRole>(context));
            
            return await roleManager.CreateAsync(new IdentityRole());
        }
Пример #2
0
        public async Task<IdentityRole> GetByNameAsync(string role)
        {
            var context = new ApplicationDbContext();

            var roleManager = new RoleManager<IdentityRole>(new RoleStore<IdentityRole>(context));

            return await roleManager.FindByNameAsync(role);
        }