public void SaveRealDataOnDB() { using (var realDataRepository = new MongoRepository.RealDataRepository()) { //We clear the collection realDataRepository.removeAll(); //We stock the retrieved diseases in DB realDataRepository.insert(RealData); } }
public void SaveRealDataOnDB() { using (var realDataRepository = new MongoRepository.RealDataRepository()) { //We clear the collection realDataRepository.removeAll(); //We stock the retrieved diseases in DB //realDataRepository.insert(RealData); Console.WriteLine("InsertRealDataInDB start..."); List <DiseaseData> listDiseaseData = RealData.DiseaseDataList; if (listDiseaseData.Count != 0) { try { //Cut in listDiseaseData.Count parts int numberOfDocument = listDiseaseData.Count; for (int i = 0; i < numberOfDocument; i++) { realDataRepository.insert( new DiseasesData( type.Symptom, listDiseaseData .Skip(i) .Take(1) .ToList() ) ); } } catch (Exception e) { Console.WriteLine(e); Console.WriteLine("Error on insertion of RealData"); } } else { Console.WriteLine("0 realData to insert!"); } Console.WriteLine("InsertRealDataInDB finished!"); } }