Exemplo n.º 1
0
        public async Task <IActionResult> CreateRoleAsync([FromBody] CreateRoleRq request)
        {
            var role = await _roleManager.FindByNameAsync(request.RoleName);

            if (role != default)
            {
                return(BadRequest("Role is already exists"));
            }

            var newRole = new ApplicationRole(request.RoleName);
            var result  = await _roleManager.CreateAsync(newRole);

            return(Ok(result.Succeeded));
        }
Exemplo n.º 2
0
 public Task <bool> CreateRoleAsync(CreateRoleRq request) =>
 PostAsync("/api/role", request);