123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using CZFW.Framework.Interface;
- using CZFW.Framework.Model;
- using CZFW.Framework.Model.Entity;
- using CZFW.Framework.Model.ViewModel;
- using System.Collections.Generic;
- using System.Linq;
- namespace CZFW.Framework.Logic
- {
- public class PrivilegeLogic : LogicBase<PrivilegeEntity>, IPrivilege
- {
-
- public IList<PrivilegeModel> GetListByGroupMark(string mark)
- {
- var res = GetSortedQueryable().Where(x => x.GroupMark == mark).Select(x => new PrivilegeModel()
- {
- Id = x.Id,
- ActionName = x.ActionName,
- AreaName = x.AreaName,
- ControllerName = x.ControllerName,
- Description = x.Description,
- GroupMark = x.GroupMark,
- Name = x.Name,
- SortOrder = x.SortOrder ?? 0,
- Url = x.Url
- }).ToList();
- return res;
- }
- public TableModel<PrivilegeModel> GetTableModelByGroupMark(string mark, int pageIndex = 1, int pageSize = 20)
- {
- var res = new TableModel<PrivilegeModel>();
- var queryable = GetSortedQueryable().Where(x => x.GroupMark == mark);
- var data = queryable.Select(x => new PrivilegeModel()
- {
- Id = x.Id,
- ActionName = x.ActionName,
- AreaName = x.AreaName,
- ControllerName = x.ControllerName,
- Description = x.Description,
- GroupMark = x.GroupMark,
- Name = x.Name,
- SortOrder = x.SortOrder ?? 0,
- Url = x.Url
- }).OrderByDescending(x=>x.SortOrder).Skip((pageIndex-1)*pageSize).Take(pageSize).ToList();
- res.SetData(data);
- var total = queryable.Count();
- res.Pager = new PagerModel(total, pageIndex, pageSize);
- res.TableHeads = PropertyHelper.Get(typeof(PrivilegeModel));
- return res;
- }
- }
- }
|