public async override Task <IdentityResult> AddClaimAsync(User user, Claim claim) { try { UserClaim userClaim = new UserClaim { UserId = user.Id, ClaimType = claim.Type, ClaimValue = claim.Value }; await _userClaimRepository.AddAsync(userClaim); return(await Task.FromResult(IdentityResult.Success).ConfigureAwait(false)); } catch (Exception) { throw; } }
public async Task <ActionResult <UserClaimDto> > PostUserClaim(UserClaimDto userClaim) { if (!ModelState.IsValid) { ModelState.AddModelError("InvalidModel", "Properties not in valid state"); return(userClaim); } await _userClaimRepository.AddAsync(_mapper.Map <UserClaim>(userClaim)); try { await _unitOfworkUserClaim.CommitAsync(_cancellationToken);; return(CreatedAtAction("GetUserClaim", new { id = userClaim.Id }, userClaim)); } catch (Exception ex) { var errMsg = ex.Message; throw; } }