Пример #1
0
        public ActionResult Edit(Patient patient, int DoctorId)
        {
            var testVariable = _db.DoctorPatient.FirstOrDefault(join => join.PatientId == patient.PatientId && join.DoctorId == DoctorId);

            if (testVariable != null)
            {
                _db.Entry(patient).State = EntityState.Modified;
                _db.SaveChanges();
                return(RedirectToAction("Details", new { id = patient.PatientId }));
            }
            if (DoctorId != 0)
            {
                _db.DoctorPatient.Add(new DoctorPatient()
                {
                    DoctorId = DoctorId, PatientId = patient.PatientId
                });
            }
            _db.Entry(patient).State = EntityState.Modified;
            _db.SaveChanges();
            return(RedirectToAction("Details", new { id = patient.PatientId }));
        }
 public ActionResult Edit(Specialty specialty, int DoctorId)
 {
     if (DoctorId != 0)
     {
         _db.DoctorSpecialty.Add(new DoctorSpecialty()
         {
             DoctorId = DoctorId, SpecialtyId = specialty.SpecialtyId
         });
     }
     _db.Entry(specialty).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Пример #3
0
 public ActionResult Edit(Doctor doctor, int PatientId)
 {
     if (PatientId != 0)
     {
         _db.DoctorPatient.Add(new DoctorPatient()
         {
             PatientId = PatientId, DoctorId = doctor.DoctorId
         });
     }
     _db.Entry(doctor).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
 public ActionResult Edit(Patient patient, int DoctorId)
 {
     if (DoctorId != 0)
     {
         _db.DoctorPatient.Add(new DoctorPatient()
         {
             DoctorId = DoctorId, PatientId = patient.PatientId
         });
     }
     _db.Entry(patient).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Пример #5
0
 public ActionResult Edit(Patient patient, int DoctorId)
 {
     if (DoctorId != 0)
     {
         bool tf = _db.DoctorPatient.Any(x => x.DoctorId == DoctorId && x.PatientId == patient.PatientId); //if true patient has already been assigned to that doctor, if false it assigns the doctor
         if (!tf)
         {
             _db.DoctorPatient.Add(new DoctorPatient()
             {
                 DoctorId = DoctorId, PatientId = patient.PatientId
             });
         }
     }
     _db.Entry(patient).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Пример #6
0
 public ActionResult Edit(Doctor doctor, int SpecialtyId)
 {
     if (SpecialtyId != 0)
     {
         bool tf = _db.DoctorSpecialty.Any(x => x.SpecialtyId == SpecialtyId && x.DoctorId == doctor.DoctorId);
         if (!tf)
         {
             _db.DoctorSpecialty.Add(new DoctorSpecialty()
             {
                 DoctorId = doctor.DoctorId, SpecialtyId = SpecialtyId
             });
         }
     }
     _db.Entry(doctor).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
 public ActionResult Edit(Specialty specialty)
 {
     _db.Entry(specialty).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Details", new { id = specialty.SpecialtyId }));
 }
 public ActionResult Edit(Doctor doctor)
 {
     _db.Entry(doctor).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Details", new { id = doctor.DoctorId }));
 }
Пример #9
0
 public ActionResult Edit(Doctor doctor)
 {
     _db.Entry(doctor).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Пример #10
0
 public ActionResult Edit(Patient patient)
 {
     _db.Entry(patient).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
 public ActionResult Edit(Patient patient)
 {
     _db.Entry(patient).State = EntityState.Modified;
     _db.SaveChanges();
     return(RedirectToAction("Details", new { id = patient.PatientId }));
 }