|
|
@ -7,6 +7,7 @@ using Infrastructure.Web.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
using Infrastructure.Extensions;
|
|
|
|
|
|
|
|
|
|
|
|
namespace UserCenter.Areas.Admin.Controllers
|
|
|
|
namespace UserCenter.Areas.Admin.Controllers
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -14,8 +15,11 @@ namespace UserCenter.Areas.Admin.Controllers
|
|
|
|
[Area(nameof(Admin))]
|
|
|
|
[Area(nameof(Admin))]
|
|
|
|
public class PermissionController : CrudController<Permission, PagedListModel<EditPermissionModel>, EditPermissionModel, EditPermissionModel>
|
|
|
|
public class PermissionController : CrudController<Permission, PagedListModel<EditPermissionModel>, EditPermissionModel, EditPermissionModel>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public PermissionController(IRepository<Permission> repo) : base(repo)
|
|
|
|
private readonly AjaxController _ajax;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public PermissionController(IRepository<Permission> repo, AjaxController ajax) : base(repo)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
this._ajax = ajax;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override IQueryable<Permission> Include(IQueryable<Permission> query)
|
|
|
|
public override IQueryable<Permission> Include(IQueryable<Permission> query)
|
|
|
@ -25,12 +29,12 @@ namespace UserCenter.Areas.Admin.Controllers
|
|
|
|
|
|
|
|
|
|
|
|
public override void ToDisplayModel(Permission entity, EditPermissionModel model)
|
|
|
|
public override void ToDisplayModel(Permission entity, EditPermissionModel model)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
model.CategoryName = entity.Category.GetFullName();
|
|
|
|
this.ViewData.Add(entity.CategoryId,entity.Category.Name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void ToModel(Permission entity, EditPermissionModel model)
|
|
|
|
public override void ToModel(Permission entity, EditPermissionModel model)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
model.CategoryName = entity.Category.GetFullName();
|
|
|
|
this.ViewData.SelectList(o=>model.CategoryId, () => this._ajax.GetPermissionCategorySelectList(model.CategoryId), model.CategoryId.HasValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|