Beispiel #1
0
        public override void Save(AuthUser entity)
        {
            var dbAuthUser = DbAuthUser.FromDomainModel(entity);

            _unitOfWork.Store(dbAuthUser, tran => AuthUserDatabase.Temp(tran).AuthUsersTable);

            foreach (var roleId in entity.RoleIds.Select(r => r.Id))
            {
                var dbAuthUserRole = new DbAuthUserRole {
                    UserId = dbAuthUser.Id,
                    RoleId = roleId
                };
                _unitOfWork.Store(dbAuthUserRole, tran => AuthUserDatabase.Temp(tran).AuthUserRolesTable);
            }
        }
        public override void Save(Role entity)
        {
            var dbRole = DbRole.FromDomainModel(entity);

            _unitOfWork.Store(dbRole, tran => AuthUserDatabase.Temp(tran).RolesTable);

            foreach (var permission in entity.Permissions.Select(p => p.Value))
            {
                var dbPermission = new DbPermissionRole {
                    Permission = permission,
                    RoleId     = dbRole.Id
                };
                _unitOfWork.Store(dbPermission, tran => AuthUserDatabase.Temp(tran).PermissionRolesTable);
            }
        }
Beispiel #3
0
        public override void Save(AdminLog entity)
        {
            var dbAdminLog = DbAdminLog.FromDomainModel(entity);

            _unitOfWork.Store(dbAdminLog, tran => AuthUserDatabase.Temp(tran).AdminLogsTable);
        }