From a4b5708b0ec22328de77c37e234a06b2d434b823 Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Tue, 12 May 2020 17:27:49 +0800 Subject: [PATCH] update Former-commit-id: 55c6f03b606824b039206dfdb1c9c26cf803f941 --- .../Infrastructure/Application/PagedListModel.cs | 4 ---- .../IoTCenter/Areas/Admin/Views/Shared/_Menu.cshtml | 8 ++++---- .../UserCenter/Application/Domain/Entities/User.cs | 1 - .../UserCenter/Application/Models/SearchUserModel.cs | 12 ++++++++++++ .../Areas/Admin/Controllers/UserController.cs | 10 +++++++--- 5 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 projects/UserCenter/Application/Models/SearchUserModel.cs diff --git a/projects/Infrastructure/Application/PagedListModel.cs b/projects/Infrastructure/Application/PagedListModel.cs index dbeae828..cd9f4aed 100644 --- a/projects/Infrastructure/Application/PagedListModel.cs +++ b/projects/Infrastructure/Application/PagedListModel.cs @@ -1,10 +1,6 @@ -using System.ComponentModel.DataAnnotations; - namespace Infrastructure.Application { public class PagedListModel : PagedList { - //[Display(Name = "已删除")] - //public bool IsDeleted { get; set; } } } \ No newline at end of file diff --git a/projects/IoTCenter/Areas/Admin/Views/Shared/_Menu.cshtml b/projects/IoTCenter/Areas/Admin/Views/Shared/_Menu.cshtml index 9d2d314d..598be389 100644 --- a/projects/IoTCenter/Areas/Admin/Views/Shared/_Menu.cshtml +++ b/projects/IoTCenter/Areas/Admin/Views/Shared/_Menu.cshtml @@ -72,19 +72,19 @@ { } - @if (User.IsInRole("Read-GlobalScene")) + @if (User.IsInRole("Read-Scene")) { } - @if (User.IsInRole("Read-GlobalSceneCommand")) + @if (User.IsInRole("Read-SceneCommand")) { } - @if (User.IsInRole("Read-GlobalSceneTimer")) + @if (User.IsInRole("Read-SceneTimer")) { } - @if (User.IsInRole("Read-GlobalSceneTigger")) + @if (User.IsInRole("Read-SceneTigger")) { } diff --git a/projects/UserCenter/Application/Domain/Entities/User.cs b/projects/UserCenter/Application/Domain/Entities/User.cs index ea98eabf..9607ab64 100644 --- a/projects/UserCenter/Application/Domain/Entities/User.cs +++ b/projects/UserCenter/Application/Domain/Entities/User.cs @@ -2,7 +2,6 @@ using Infrastructure.Domain; using Infrastructure.Web.Mvc; using System; using System.Collections.Generic; -using System.ComponentModel; using System.ComponentModel.DataAnnotations; namespace Application.Domain.Entities diff --git a/projects/UserCenter/Application/Models/SearchUserModel.cs b/projects/UserCenter/Application/Models/SearchUserModel.cs new file mode 100644 index 00000000..45096297 --- /dev/null +++ b/projects/UserCenter/Application/Models/SearchUserModel.cs @@ -0,0 +1,12 @@ +using Application.Models; +using Infrastructure.Application; +using System.ComponentModel.DataAnnotations; + +namespace UserCenter.Application.Models +{ + public class SearchUserModel : PagedListModel + { + [Display(Name = "已移除")] + public bool IsDeleted { get; set; } + } +} \ No newline at end of file diff --git a/projects/UserCenter/Areas/Admin/Controllers/UserController.cs b/projects/UserCenter/Areas/Admin/Controllers/UserController.cs index 7eeb65c0..86496d85 100644 --- a/projects/UserCenter/Areas/Admin/Controllers/UserController.cs +++ b/projects/UserCenter/Areas/Admin/Controllers/UserController.cs @@ -1,6 +1,5 @@ using Application.Domain.Entities; using Application.Models; -using Infrastructure.Application; using Infrastructure.Data; using Infrastructure.Extensions; using Infrastructure.Security; @@ -8,14 +7,14 @@ using Infrastructure.Web.Mvc; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; -using System; using System.Linq; +using UserCenter.Application.Models; namespace UserCenter.Areas.Admin.Controllers { [Authorize] [Area(nameof(Admin))] - public class UserController : CrudController, EditUserModel, EditUserModel> + public class UserController : CrudController { private readonly IEncryptionService _encrypitonService; private readonly AjaxController _ajax; @@ -27,6 +26,11 @@ namespace UserCenter.Areas.Admin.Controllers this._ajax = ajax; } + public override IQueryable Query(SearchUserModel model, IQueryable query) + { + return query.WhereIf(!model.IsDeleted, o => o.IsDeleted == null); + } + public override IQueryable Include(IQueryable query) { return query.Include(o => o.UserRoles).ThenInclude(o => o.Role);