public void UpdateTrain(Train train) { ICollectionCreator cc = _cf.CreateCollection(); MongoTrain mTrain = new MongoTrain() { Carriages = train.Carriages, StartLocation = train.StartLocation, EndLocation = train.EndLocation, TrainId = train.Id, Number = train.Number }; cc.Trains.ReplaceOneAsync(new BsonDocument("_id", train.Id), mTrain); }
public void CreateTrain(Train train) { ICollectionCreator cc = _cf.CreateCollection(); MongoTrain mTrain = new MongoTrain { Carriages = train.Carriages, StartLocation = train.StartLocation, EndLocation = train.EndLocation, TrainId = train.Id, Number = train.Number }; cc.Trains.InsertOne(mTrain); }