Former-commit-id: 55c6f03b606824b039206dfdb1c9c26cf803f941
TangShanKaiPing
wanggang 5 years ago
parent 40cc170bf2
commit a4b5708b0e

@ -1,10 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace Infrastructure.Application
{
public class PagedListModel<T> : PagedList<T>
{
//[Display(Name = "已删除")]
//public bool IsDeleted { get; set; }
}
}

@ -72,19 +72,19 @@
{
<li class="nav-item"><a class="nav-link @GetClass("SceneTigger")" href="@Url.Action("Index","SceneTigger")"><i class="nav-icon fa fa-fire"></i><span>场景触发器管理</span></a></li>
}
@if (User.IsInRole("Read-GlobalScene"))
@if (User.IsInRole("Read-Scene"))
{
<li class="nav-item"><a class="nav-link @GetClass("GlobalScene")" href="@Url.Action("Index","GlobalScene")"><i class="nav-icon fa fa-list-ol"></i><span>平台场景管理</span></a></li>
}
@if (User.IsInRole("Read-GlobalSceneCommand"))
@if (User.IsInRole("Read-SceneCommand"))
{
<li class="nav-item"><a class="nav-link @GetClass("GlobalSceneCommand")" href="@Url.Action("Index","GlobalSceneCommand")"><i class="nav-icon far fa-circle"></i><span>平台场景命令管理</span></a></li>
}
@if (User.IsInRole("Read-GlobalSceneTimer"))
@if (User.IsInRole("Read-SceneTimer"))
{
<li class="nav-item"><a class="nav-link @GetClass("GlobalSceneTimer")" href="@Url.Action("Index","GlobalSceneTimer")"><i class="nav-icon far fa-clock"></i><span>平台场景定时器管理</span></a></li>
}
@if (User.IsInRole("Read-GlobalSceneTigger"))
@if (User.IsInRole("Read-SceneTigger"))
{
<li class="nav-item"><a class="nav-link @GetClass("GlobalSceneTigger")" href="@Url.Action("Index","GlobalSceneTigger")"><i class="nav-icon fa fa-fire"></i><span>平台场景触发器管理</span></a></li>
}

@ -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

@ -0,0 +1,12 @@
using Application.Models;
using Infrastructure.Application;
using System.ComponentModel.DataAnnotations;
namespace UserCenter.Application.Models
{
public class SearchUserModel : PagedListModel<EditUserModel>
{
[Display(Name = "已移除")]
public bool IsDeleted { get; set; }
}
}

@ -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<User, PagedListModel<EditUserModel>, EditUserModel, EditUserModel>
public class UserController : CrudController<User, SearchUserModel, EditUserModel, EditUserModel>
{
private readonly IEncryptionService _encrypitonService;
private readonly AjaxController _ajax;
@ -27,6 +26,11 @@ namespace UserCenter.Areas.Admin.Controllers
this._ajax = ajax;
}
public override IQueryable<User> Query(SearchUserModel model, IQueryable<User> query)
{
return query.WhereIf(!model.IsDeleted, o => o.IsDeleted == null);
}
public override IQueryable<User> Include(IQueryable<User> query)
{
return query.Include(o => o.UserRoles).ThenInclude(o => o.Role);

Loading…
Cancel
Save