feat: 重构代码

This commit is contained in:
Argo-Tianyi 2022-01-20 13:22:25 +08:00
parent 08b02e9579
commit a602539ec5
1 changed files with 1 additions and 2 deletions

View File

@ -1,6 +1,5 @@
using Bootstrap.Security.Blazor; using Bootstrap.Security.Blazor;
using BootstrapAdmin.DataAccess.Models; using BootstrapAdmin.DataAccess.Models;
using Microsoft.AspNetCore.Components.Authorization;
namespace BootstrapAdmin.Web.Core.Services; namespace BootstrapAdmin.Web.Core.Services;
@ -66,7 +65,7 @@ public class AdminService : IBootstrapAdminService
var menu = menus.FirstOrDefault(m => m.Url.Contains(url, StringComparison.OrdinalIgnoreCase)); var menu = menus.FirstOrDefault(m => m.Url.Contains(url, StringComparison.OrdinalIgnoreCase));
if (menu != null) if (menu != null)
{ {
ret = menus.FirstOrDefault(m => m.ParentId == menu.Id && m.IsResource == EnumResource.Block && m.Url.Equals(blockName, StringComparison.OrdinalIgnoreCase)) != null; ret = menus.Any(m => m.ParentId == menu.Id && m.IsResource == EnumResource.Block && m.Url.Equals(blockName, StringComparison.OrdinalIgnoreCase));
} }
} }
return ret; return ret;