public async Task UpdateAsync()
    {
        //Arrange

        var moderator = await GetRoleAsync("moderator");

        var input = new IdentityRoleUpdateDto
        {
            Name             = Guid.NewGuid().ToString("N").Left(8),
            ConcurrencyStamp = moderator.ConcurrencyStamp,
            IsDefault        = moderator.IsDefault,
            IsPublic         = moderator.IsPublic
        };

        //Act

        var result = await _roleAppService.UpdateAsync(moderator.Id, input);

        //Assert

        result.Id.ShouldBe(moderator.Id);
        result.Name.ShouldBe(input.Name);

        var updatedRole = await _roleRepository.GetAsync(moderator.Id);

        updatedRole.Name.ShouldBe(input.Name);
    }
Beispiel #2
0
 public virtual async Task <IdentityRoleDto> UpdateAsync(Guid id, IdentityRoleUpdateDto input)
 {
     return(await RequestAsync <IdentityRoleDto>(nameof(UpdateAsync), new ClientProxyRequestTypeValue
     {
         { typeof(Guid), id },
         { typeof(IdentityRoleUpdateDto), input }
     }));
 }
Beispiel #3
0
    public virtual async Task <IdentityRoleDto> UpdateAsync(Guid id, IdentityRoleUpdateDto input)
    {
        var role = await RoleManager.GetByIdAsync(id);

        role.SetConcurrencyStampIfNotNull(input.ConcurrencyStamp);

        (await RoleManager.SetRoleNameAsync(role, input.Name)).CheckErrors();

        role.IsDefault = input.IsDefault;
        role.IsPublic  = input.IsPublic;

        input.MapExtraPropertiesTo(role);

        (await RoleManager.UpdateAsync(role)).CheckErrors();
        await CurrentUnitOfWork.SaveChangesAsync();

        return(ObjectMapper.Map <IdentityRole, IdentityRoleDto>(role));
    }
Beispiel #4
0
 /// <summary>
 /// Updates the specified identifier.
 /// </summary>
 /// <param name="id">The identifier.</param>
 /// <param name="input">The input.</param>
 /// <returns>Task&lt;IdentityRoleDto&gt;.</returns>
 public virtual Task <IdentityRoleDto> Update(string id, IdentityRoleUpdateDto input)
 {
     return(_appService.UpdateAsync(id.ToGuid(), input));
 }
Beispiel #5
0
 public virtual Task <IdentityRoleDto> UpdateAsync(Guid id, IdentityRoleUpdateDto input)
 {
     return(RoleAppService.UpdateAsync(id, input));
 }