Example #1
0
 private void SaveUsers(Role role, string[] userTag)
 {
     var list = new List<UserProfile>();
     var userTags= userTag.ToList().Select(int.Parse);
     userTags.ToList().ForEach(m =>
     {
         var model = this._userProfileService.Get(m);
         model.RoleId = role.Id;
         list.Add(model);
     });
     this._userProfileService.Update(list);
 }
Example #2
0
 private void SaveRoleApps(Role role, string [] roleAppTag)
 {
     var list = new  List<RoleApp>();
     roleAppTag.ToList().ForEach(m =>
     {
         var model = new RoleApp
         {
             AppId = int.Parse(m),
             RoleId = role.Id,
             AddTime = DateTime.Now,
             DisplayOrder = 0
         };
         list.Add(model);
     });
     this._roleAppService.Add(list);
 }
Example #3
0
 public static Role ToEntity(this RoleModel model, Role destination)
 {
     return Mapper.Map(model, destination);
 }
Example #4
0
 public void Add(Role entity)
 {
     this._roleProfileRepository.Insert(entity);
 }
Example #5
0
 public void Delete(Role entity)
 {
     this._roleProfileRepository.Delete(entity);
 }
Example #6
0
 public void Update(Role entity)
 {
     this._roleProfileRepository.Update(entity);
 }
Example #7
0
        private void PrepareNoAddedUser(RoleModel model, Role role)
        {
            var data = from t in _userProfileService.List()
                //2代码默认权限
                where t.RoleId == 2
                orderby t.Id
                select t;
            var list = data.ToList().Select(m => m.ToModel());
;
            model.NoAddedUser = list.ToList();
        }
Example #8
0
 private void PrepareAddedUser(RoleModel model, Role role)
 {
     var userList = this._userProfileService.List().Where(m => m.RoleId == role.Id).ToList();
     var roleAppListsModel = userList
         .Select(x =>x.ToModel());
     model.AddedUser = roleAppListsModel.ToList();
 }
Example #9
0
 private void PrepareNoAddedApp(RoleModel model, Role role)
 {
     List<int> noAddedAppList = GetNoAddedApp(role.Id);
     var data = from t in _appService.List()
                where noAddedAppList.Any(m => m == t.Id)
                orderby t.Id
                select new RoleModel.RoleAppModel
                {
                    AppId = t.Id,
                    AppName = t.Name,
                    AppUrl = t.RouteUrl
                };
     model.NoAddedApp = data.ToList();
 }
Example #10
0
 private void PrepareAddedApp(RoleModel model, Role role)
 {
     var roleAppList = _roleAppService.GetRoleAppByRoleId(role.Id);
     var roleAppListsModel = roleAppList
         .Select(x =>
             new RoleModel.RoleAppModel
             {
                 RoleId = x.RoleId,
                 AppId = x.AppId,
                 AppName = x.App.Name,
                 DisplayOrder = x.DisplayOrder,
                 AppUrl = x.App.RouteUrl
             });
     model.AddedApp = roleAppListsModel.ToList();
 }