public async Task <bool> CreateRolAsync(CreateRolRequestDto rolRequest) { IdentityRole identityRole = new IdentityRole { Name = rolRequest.RoleName }; IdentityResult result = await _roleManager.CreateAsync(identityRole); return(result.Succeeded); }
public async Task <IActionResult> CreateRol(CreateRolRequestDto model) { if (ModelState.IsValid) { bool result = await _authenticateService.CreateRolAsync(model); if (result) { return(Ok(result)); } _fullErrorList = "Falló al intentar crear Rol"; ModelState.AddModelError("message", _fullErrorList); } return(BadRequest(ModelState)); }