상속: IdentityRole
예제 #1
0
        public async Task<ActionResult> Create(UserRoleViewModel userRoleViewModel)
        {
            if (!ModelState.IsValid) return View();

            var role = new BlogRole(userRoleViewModel.Name)
            {
                Description = userRoleViewModel.Description
            };

            // Save the new Description property:
            var roleresult = await RoleManager.CreateAsync(role);
            if (roleresult.Succeeded) return RedirectToAction("Index");

            ModelState.AddModelError("", roleresult.Errors.First());
            return View();
        }
예제 #2
0
 public async Task<IdentityResult> CreateRoleAsync(BlogRole blogRole)
 {
     var roleresult = await _roleManager.CreateAsync(blogRole);
     return roleresult;
 }