public async Task Handle(InstanceSettingsPushedEvent notification, CancellationToken cancellationToken) { foreach (var machine in notification.Account.Machines) { await AddUserOperation(UserOperationTypes.PushInstanceSettings, machine.Id, notification.Actor, cancellationToken); } }
public async Task Handle(InstanceSettingsPushedEvent notification, CancellationToken cancellationToken) { try { var desiredStates = notification.Account.Machines.Select(x => x.States.First(y => y.Desired)); foreach (var desiredState in desiredStates) { _context.Set <HistoricalDesiredState>().Add(Mapper.Map <HistoricalDesiredState>(desiredState)); } await _context.SaveChangesAsync(cancellationToken); } catch (Exception e) { _logger.LogError(e.Message); } }
public async Task Handle(InstanceSettingsPushedEvent notification, CancellationToken cancellationToken) { await AddAuditLogAsync("PushInstanceSettings", notification.Actor, DateTime.Now, new[] { Mapper.Map <AccountRef>(notification.Account) }, null, new { Params = notification.Command, Changes = notification.Changes }); }