Пример #1
0
        public void Delete(FertilityModel fertilityModel)
        {
            FertilityModel fertilityModelInDb = _context.FertilityModels.Single(fm => fm.Id == fertilityModel.Id);

            _context.FertilityModels.Remove(fertilityModelInDb);

            _context.SaveChanges();
        }
Пример #2
0
        public void Edit(FertilityModel fertilityModel)
        {
            FertilityModel fertilityModelInDb = _context.FertilityModels.Single(fm => fm.Id == fertilityModel.Id);

            //  fertilityModelInDb.Id = fertilityModel.Id ?? fertilityModelInDb.Id;
            fertilityModelInDb.Fertility1960 = fertilityModel.Fertility1960 ?? fertilityModelInDb.Fertility1960;
            fertilityModelInDb.Fertility2016 = fertilityModel.Fertility2016 ?? fertilityModelInDb.Fertility2016;
            fertilityModelInDb.Iq            = fertilityModel.Iq ?? fertilityModelInDb.Iq;

            _context.SaveChanges();
        }
Пример #3
0
 public void AddNew(FertilityModel fertilityModel)
 {
     _context.FertilityModels.Add(fertilityModel);
     _context.SaveChanges();
 }
Пример #4
0
        public FertilityModel GetFertilityModel(string Id)
        {
            FertilityModel fertilityModel = _context.FertilityModels.SingleOrDefault(fm => fm.Id == Id);

            return(fertilityModel);
        }