public async Task CreateTrain(Guid trainId, DateTime dateOper, string station)
        {
            var opTrain = new OpTrain
            {
                SourceStation = station,
                Datop         = dateOper,
                Kop           = OperationCode.TrainComposition,
                Msgid         = DateTime.Now,
                TrainId       = trainId,
                LastOper      = true
            };

            _context.Add(opTrain);
            _logger.LogInformation("Saving operation to train", opTrain);
            var affected = await _context.SaveChangesAsync();

            _logger.LogInformation($"Saved {affected} of 1 records");
        }
        public async Task CorrectComposition(Guid trainId, DateTime timeOper, string station)
        {
            OpTrain correctOperation = new OpTrain()
            {
                Datop         = timeOper,
                Kop           = OperationCode.CorrectingComposition,
                Msgid         = DateTime.Now,
                SourceStation = station,
                TrainId       = trainId
            };

            _context.OpTrain.Add(correctOperation);
            _logger.LogInformation($"Train Operation {OperationCode.CorrectingComposition} added", correctOperation);

            var affected = await _context.SaveChangesAsync();

            _logger.LogInformation($"Saved {affected} of + 1 record");

            await UpdateTrainParameters(trainId);
        }
        public async Task ProcessTrain(Guid trainId, string station, DateTime timeOper, string operationCode)
        {
            _logger.LogInformation($"Processing operation {operationCode} for train {trainId}");

            OpTrain newOperation = new OpTrain()
            {
                Datop         = timeOper,
                Kop           = operationCode,
                Msgid         = DateTime.Now,
                SourceStation = station,
                TrainId       = trainId
            };

            _context.OpTrain.Add(newOperation);
            _logger.LogInformation("Saving operation to train", newOperation);

            var affected = await _context.SaveChangesAsync();

            _logger.LogInformation($"Saved {affected} of 1 record");
        }