diff --git a/TransportCompany/TransportCompamyMongoDBImplementer/Implements/TransportStorage.cs b/TransportCompany/TransportCompamyMongoDBImplementer/Implements/TransportStorage.cs index 9d629d6..e7e5f1f 100644 --- a/TransportCompany/TransportCompamyMongoDBImplementer/Implements/TransportStorage.cs +++ b/TransportCompany/TransportCompamyMongoDBImplementer/Implements/TransportStorage.cs @@ -95,10 +95,48 @@ namespace TransportCompamyMongoDBImplementer.Implements List models = model.Select(x => Transport.Create(new() { - Tranport = x.Tranport, - TransportationType = "Что-то" + Tranport = x.Tranport })).ToList(); + //цикл для перезаписи типа грузоперевозки + foreach (var transport in models) + { + if (transport.TransportType.Equals("Баржа")) + { + transport.TransportationType = "Грузовая"; + } + + if (transport.TransportType.Equals("Вертолёт")) + { + transport.TransportationType = "Пассажирская"; + } + + if (transport.TransportType.Equals("Самолёт")) + { + transport.TransportationType = "Пассажирская"; + } + + if (transport.TransportType.Equals("Легковой автомобиль")) + { + transport.TransportationType = "Пассажирская"; + } + + if (transport.TransportType.Equals("Фура")) + { + transport.TransportationType = "Грузовая"; + } + + if (transport.TransportType.Equals("Минивен")) + { + transport.TransportationType = "Грузовая"; + } + + if (transport.TransportType.Equals("Открытый грузовик")) + { + transport.TransportationType = "Перевозка животных"; + } + } + transportCollection.InsertMany(models); return true; diff --git a/TransportCompany/TransportCompany/FormTransport.cs b/TransportCompany/TransportCompany/FormTransport.cs index 2d5718b..98142c7 100644 --- a/TransportCompany/TransportCompany/FormTransport.cs +++ b/TransportCompany/TransportCompany/FormTransport.cs @@ -51,6 +51,7 @@ namespace TransportCompany { dataGridView.Columns["Id"].Visible = true; dataGridView.Columns["MongoId"].Visible = false; + dataGridView.Columns["TransportationType"].Visible = false; } else { @@ -58,7 +59,7 @@ namespace TransportCompany dataGridView.Columns["MongoId"].Visible = true; } - dataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; + dataGridView.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } _logger.LogInformation("Загрузка транспортных средств");