public ActionResult Edit(IllPersonEditViewModel ıllPersonEditViewModel) { if (ModelState.IsValid) { var ıllPerson = ıllPersonService.GetById(ıllPersonEditViewModel.IllPerson.Id);//id ye karşılık person ıllPerson.Name = ıllPersonEditViewModel.IllPerson.Name; ıllPerson.Surname = ıllPersonEditViewModel.IllPerson.Surname; ıllPerson.Phone = ıllPersonEditViewModel.IllPerson.Phone; ıllPerson.Email = ıllPersonEditViewModel.IllPerson.Email; var doctorIllPersons = db.Doctor_IllPersons.Where(e => e.IllPersonId == ıllPerson.Id).ToList(); foreach (var doctorIllPerson in doctorIllPersons) { db.Doctor_IllPersons.Remove(doctorIllPerson); db.SaveChanges(); } ıllPerson.Doctor_IllPersons = ıllPersonEditViewModel.doctorIds.Select(e => new Doctor_IllPerson() { DoctorId = e, IllPersonId = ıllPerson.Id }).ToList(); ıllPersonService.Update(ıllPerson); return(RedirectToAction("Index")); } return(View(ıllPersonEditViewModel)); }
public void Delete(int?id) { var doctorIllPersons = db.Doctor_IllPersons.Where(e => e.IllPersonId == id.Value).ToList(); foreach (var doctorIllPerson in doctorIllPersons) { db.Doctor_IllPersons.Remove(doctorIllPerson); db.SaveChanges(); } }
private void FinalizeRegistration(RegisterModel model) { using (DoctorsContext context = new DoctorsContext()) { var doctor = context.DoctorProfiles.First(x => x.Email == model.Email); doctor.Name = model.Name; doctor.LastName = model.LastName; doctor.SecondName = model.SecondName; doctor.PhoneNumber = model.PhoneNumber; doctor.Organisation = model.Organisation; doctor.Position = model.Position; context.SaveChanges(); } }
public void Add(Doctor doctor) { db.Doctors.Add(doctor); db.SaveChanges(); }
public void Add(Titles title) { db.Titles.Add(title); db.SaveChanges(); }
public void Add(IllPerson ıllPerson) { db.IllPersons.Add(ıllPerson); db.SaveChanges(); }