diff --git a/Server/Server/DB/CityDB.cs b/Server/Server/DB/CityDB.cs index 193d242..aff821b 100644 --- a/Server/Server/DB/CityDB.cs +++ b/Server/Server/DB/CityDB.cs @@ -24,8 +24,12 @@ namespace Server.DB using (Context ctx = new Context()) { var country = ctx.Countries.FirstOrDefault(c => c.CountryID == city.Country.CountryID); + ctx.Countries.Attach(country); + ctx.Cities.Add(city); + + city.Country = country; ctx.SaveChanges(); } return true; diff --git a/Server/Server/DB/DoctorDB.cs b/Server/Server/DB/DoctorDB.cs index 22cb29b..dac8743 100644 --- a/Server/Server/DB/DoctorDB.cs +++ b/Server/Server/DB/DoctorDB.cs @@ -34,6 +34,11 @@ namespace Server.DB ctx.Countries.Attach(country); ctx.Genders.Attach(gender); ctx.Salutations.Attach(salutation); + + doctor.City = city; + doctor.Salutation = salutation; + doctor.Gender = gender; + ctx.Doctors.Add(doctor); ctx.SaveChanges(); } diff --git a/Server/Server/DB/ExamDb.cs b/Server/Server/DB/ExamDb.cs index 0a56680..456cb24 100644 --- a/Server/Server/DB/ExamDb.cs +++ b/Server/Server/DB/ExamDb.cs @@ -47,6 +47,11 @@ namespace Server.DB ctx.Genders.Attach(pGender); ctx.Salutations.Attach(dSalutation); ctx.Salutations.Attach(pSalutation); + + exam.Doctor = doctor; + exam.Patient = patient; + exam.Strain = strain; + ctx.Exams.Add(exam); ctx.SaveChanges(); } diff --git a/Server/Server/DB/FoodPlaceDB.cs b/Server/Server/DB/FoodPlaceDB.cs index 0464758..afc5e77 100644 --- a/Server/Server/DB/FoodPlaceDB.cs +++ b/Server/Server/DB/FoodPlaceDB.cs @@ -29,6 +29,9 @@ namespace Server.DB ctx.Cities.Attach(city); ctx.Countries.Attach(country); + + foodplace.City = city; + ctx.FoodPlaces.Add(foodplace); ctx.SaveChanges(); }