示例#1
0
 private void CreateBathAreas(IEnumerable <BathArea> bathAreas)
 {
     using (BathContext db = new BathContext())
     {
         db.BathAreas.AddRange(bathAreas);
         db.SaveChanges();
     }
 }
示例#2
0
        public void SaveDateToDataBase(string path, IEnumerable <BathArea> bathAreas)
        {
            IEnumerable <BathData> datas = _dataReader.ReadAllDataFromDb();
            BathData bathData            = datas.FirstOrDefault();

            if (bathData != null)
            {
                return;
            }

            string[] fileData = _fileReader.ReadFile(path);
            datas = _objectCreator.CreateAllBathDataObjects(fileData);

            CreateBathAreas(bathAreas);

            using (BathContext db = new BathContext())
            {
                db.BathDatas.AddRange(datas);
                db.SaveChanges();
            }
        }
示例#3
0
 public DataReader()
 {
     _db = new BathContext();
 }