public IdentityResult UpdateRole(ApplicationIdentityRoleDto roleDto)
        {
            var role = mapper.Map <IdentityRole>(roleDto);

            Context.Entry(role).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            if (SaveChanges() == 1)
            {
                return(IdentityResult.Success);
            }
            else
            {
                return(IdentityResult.Failed());
            }
        }
        public IdentityResult CreateRole(ApplicationIdentityRoleDto roleDto)
        {
            roleDto.Id = GetSecureId();
            var role = mapper.Map <IdentityRole>(roleDto);

            Context.Entry(role).State = Microsoft.EntityFrameworkCore.EntityState.Added;
            if (SaveChanges() == 1)
            {
                return(IdentityResult.Success);
            }
            else
            {
                return(IdentityResult.Failed());
            }
        }
示例#3
0
 public void SetNormalizedRoleName([FromBody] ApplicationIdentityRoleDto role, string normalizedName)
 {
     _authenticationManager.SetNormalizedRoleName(role, normalizedName);
 }
示例#4
0
 public void SetIdentityRoleDtoName([FromBody] ApplicationIdentityRoleDto role, string roleName)
 {
     _authenticationManager.SetIdentityRoleDtoName(role, roleName);
 }
示例#5
0
 public string GetNormalizedRoleName([FromQuery] ApplicationIdentityRoleDto role)
 {
     return(_authenticationManager.GetNormalizedRoleName(role));
 }
示例#6
0
 public string GetIdentityRoleDtoId([FromQuery] ApplicationIdentityRoleDto role)
 {
     return(_authenticationManager.GetIdentityRoleDtoId(role));
 }
示例#7
0
 public IdentityResult CreateRole([FromBody] ApplicationIdentityRoleDto role)
 {
     return(_authenticationManager.CreateRole(role));
 }
 public void SetNormalizedRoleName(ApplicationIdentityRoleDto role, string normalizedName)
 {
     throw new NotImplementedException();
 }
 public void SetIdentityRoleDtoName(ApplicationIdentityRoleDto role, string roleName)
 {
     throw new NotImplementedException();
 }
        public string GetNormalizedRoleName(ApplicationIdentityRoleDto roleDto)
        {
            var role = Context.Set <IdentityRole>().Where(r => r.Id == roleDto.Id || r.Name == roleDto.Name).SingleOrDefault();

            return(role?.Name.Trim());
        }
        public string GetIdentityRoleDtoId(ApplicationIdentityRoleDto roleDto)
        {
            var role = Context.Set <IdentityRole>().Where(r => r.Id == roleDto.Id || r.Name == roleDto.Name).FirstOrDefault();

            return(role?.Id);
        }