Пример #1
0
        public Task AddOrgUnitGroupPermission(int orgUnitId, int groupId, int permissionId)
        {
            var entity = new OrgUnitGroupPermission
            {
                OrgUnitId         = orgUnitId,
                GroupId           = groupId,
                PermissionLevelId = permissionId
            };

            var userGroupRepository = Repository.GetWithContext <IOrgUnitGroupPermissionRepository>();

            userGroupRepository.Add(entity);

            return(Repository.SaveChangesAsync());
        }
Пример #2
0
        public Task RemoveOrgUnitGroupPermission(int orgUnitId, int groupId, int permissionId)
        {
            var entity = new OrgUnitGroupPermission
            {
                OrgUnitId         = orgUnitId,
                GroupId           = groupId,
                PermissionLevelId = permissionId
            };

            var repository = Repository.GetWithContext <IOrgUnitGroupPermissionRepository>();

            repository.Attach(entity);
            repository.Delete(entity);

            return(Repository.SaveChangesAsync());
        }
 public OrgUnitGroupPermissionModel(OrgUnitGroupPermission permission)
 {
     _permission = permission;
     _group      = new GroupModel(_permission.Group);
 }