public Task Handle(OperationTaskProgressEvent message) { var operation = _dbContext.Operations.FirstOrDefault(op => op.Id == message.OperationId); var task = _dbContext.OperationTasks.FirstOrDefault(op => op.Id == message.TaskId); if (operation != null) { var opLogEntry = new OperationLogEntry { Id = message.Id, Message = message.Message, Operation = operation, Task = task, Timestamp = message.Timestamp }; _dbContext.Add(opLogEntry); _dbContext.SaveChanges(); } Console.WriteLine(message.Message); return(Task.CompletedTask); }
public Task Handle(ConvergeVirtualMachineProgressEvent message) { var operation = _dbContext.Operations.FirstOrDefault(op => op.Id == message.OperationId); if (operation != null) { var opLogEntry = new OperationLog { Id = Guid.NewGuid(), Message = message.Message, Operation = operation, Timestamp = DateTime.Now }; _dbContext.Add(opLogEntry); _dbContext.SaveChanges(); } Console.WriteLine(message.Message); return(Task.CompletedTask); }