/// <summary>
        /// This will update a role
        /// </summary>
        /// <param name="roleName"></param>
        /// <param name="description"></param>
        /// <param name="permissions"></param>
        public async Task UpdateRoleAsync(
            string roleName,
            string description,
            ICollection <Permission> permissions)
        {
            RoleToPermissions existingRole = await _repository.GetRoleToPermissionAsync(roleName);

            if (existingRole == null)
            {
                throw new KeyNotFoundException($"Could not find the role {roleName} to update.");
            }
            existingRole.Update(description, permissions);
            await _repository.UpdateAsync(existingRole);
        }
Beispiel #2
0
 /// <summary>
 /// 更新实体
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Update(T_RoleToPermissions model)
 {
     return(dal.Update(model));
 }