Esempio n. 1
0
        public int AddKsbBillets()
        {
            var ksbBillets = new List <InsulatedBillet>
            {
                new InsulatedBillet {
                    ConductorId = 31, PolymerGroupId = 3, OperatingVoltageId = 5, Diameter = 1.95m, MinThickness = null, NominalThickness = null, CableBrandNameId = 8
                },
                new InsulatedBillet {
                    ConductorId = 17, PolymerGroupId = 3, OperatingVoltageId = 5, Diameter = 2.4m, MinThickness = null, NominalThickness = null, CableBrandNameId = 8
                },
                new InsulatedBillet {
                    ConductorId = 18, PolymerGroupId = 3, OperatingVoltageId = 5, Diameter = 2.8m, MinThickness = null, NominalThickness = null, CableBrandNameId = 8
                },
                new InsulatedBillet {
                    ConductorId = 19, PolymerGroupId = 3, OperatingVoltageId = 5, Diameter = 2.8m, MinThickness = null, NominalThickness = null, CableBrandNameId = 8
                },
                new InsulatedBillet {
                    ConductorId = 20, PolymerGroupId = 3, OperatingVoltageId = 5, Diameter = 3.2m, MinThickness = null, NominalThickness = null, CableBrandNameId = 8
                },
                new InsulatedBillet {
                    ConductorId = 21, PolymerGroupId = 3, OperatingVoltageId = 5, Diameter = 3.35m, MinThickness = null, NominalThickness = null, CableBrandNameId = 8
                }
            };

            _dbContext.AddRange(ksbBillets);

            return(_dbContext.SaveChanges());
        }
Esempio n. 2
0
        public int ParseDataToDatabase()
        {
            int recordsCount = 0;

            using (var dbContext = new CablesContext(_connectionString))
            {
                dbContext.Conductors.AddRange(_conductors);
                var count = dbContext.SaveChanges();
            }
            return(recordsCount);
        }