public async Task <bool> DeleteClaimToUserAsync(ClaimToUserRequestDto claimToUserRequestDtoRequest) { var user = await _userManager.FindByEmailAsync(claimToUserRequestDtoRequest.UserEmail); if (user != null) { Claim claim = new Claim(claimToUserRequestDtoRequest.NewClaimName, claimToUserRequestDtoRequest.NewClaimValue); var result = await _userManager.RemoveClaimAsync(user, claim); return(result.Succeeded); } return(false); }
public async Task <IActionResult> DeleteClaimToUser(ClaimToUserRequestDto model) { if (ModelState.IsValid) { bool result = await _authenticateService.DeleteClaimToUserAsync(model); if (result) { return(Ok(result)); } _fullErrorList = "Falló al intentar eliminar atributo al usuario"; ModelState.AddModelError("message", _fullErrorList); } return(BadRequest(ModelState)); }
public async Task <IActionResult> DeleteClaimToUserWithParams(string newClaimName, string newClaimValue, string userEmail) { ClaimToUserRequestDto model = new ClaimToUserRequestDto() { NewClaimName = newClaimName, NewClaimValue = newClaimValue, UserEmail = userEmail }; if (ModelState.IsValid) { bool result = await _authenticateService.DeleteClaimToUserAsync(model); if (result) { return(Ok(result)); } _fullErrorList = "Falló al intentar eliminar atributo al usuario"; ModelState.AddModelError("message", _fullErrorList); } return(BadRequest(ModelState)); }