예제 #1
0
 public ActionResult Create(Specialty specialty, int DoctorId)
 {
     _db.Specialties.Add(specialty);
     if (DoctorId != 0)
     {
         _db.DoctorSpecialty.Add(new DoctorSpecialty()
         {
             DoctorId = DoctorId, SpecialtyId = specialty.SpecialtyId
         });
     }
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
예제 #2
0
 public ActionResult Create(Patient patient, int DoctorId)
 {
     _db.Patients.Add(patient);
     if (DoctorId != 0)
     {
         _db.DoctorPatient.Add(new DoctorPatient()
         {
             DoctorId = DoctorId, PatientId = patient.PatientId
         });
     }
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
 public ActionResult Create(Doctor doctor, int SpecialtyId)
 {
     _db.Doctors.Add(doctor);
     if (SpecialtyId != 0)
     {
         _db.DoctorSpecialty.Add(new DoctorSpecialty()
         {
             SpecialtyId = SpecialtyId, DoctorId = doctor.DoctorId
         });
     }
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
예제 #4
0
        public async Task <ActionResult> Create(Doctor doctor)
        {
            try
            {
                var userId      = this.User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
                var currentUser = await _userManager.FindByIdAsync(userId);

                doctor.User = currentUser;
                _db.Doctors.Add(doctor);
                _db.SaveChanges();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception Error in Create(): " + ex);
            }
            return(RedirectToAction("Index"));
        }
예제 #5
0
        public ActionResult Create(Patient patient, int[] doctorId)
        {
            _db.Patients.Add(patient);

            foreach (var id in doctorId)
            {
                if (id != 0)
                {
                    _db.DoctorPatient.Add(new DoctorPatient()
                    {
                        DoctorId = id, PatientId = patient.PatientId
                    });
                }
            }

            _db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #6
0
        public async Task <ActionResult> Create(Patient patient, int DoctorId)
        {
            try
            {
                var userId      = this.User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
                var currentUser = await _userManager.FindByIdAsync(userId);

                patient.User = currentUser;
                _db.Patients.Add(patient);
                if (DoctorId != 0)
                {
                    _db.DoctorPatients.Add(new DoctorPatient()
                    {
                        DoctorId = DoctorId, PatientId = patient.PatientId
                    });
                }
                _db.SaveChanges();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception Error in Create(): " + ex);
            }
            return(RedirectToAction("Index"));
        }
 public ActionResult Create(Specialty specialty)
 {
     _db.Specialties.Add(specialty);
     _db.SaveChanges();
     return(RedirectToAction("Details", new { id = specialty.SpecialtyId }));
 }
예제 #8
0
 public ActionResult Create(Doctor doctor)
 {
   _db.Doctors.Add(doctor);
   _db.SaveChanges();
   return RedirectToAction("Index");
 }
예제 #9
0
 public ActionResult Create(Patient patient)
 {
     _db.Patient.Add(patient);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
예제 #10
0
 public ActionResult Create(Specialty specialty)
 {
     _db.Specialties.Add(specialty);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
예제 #11
0
 public ActionResult Create(Patient patient)
 {
     _db.Patients.Add(patient);
     _db.SaveChanges();
     return(RedirectToAction("Details", new { id = patient.PatientId }));
 }
예제 #12
0
 public ActionResult Create(Doctor doctor)
 {
     _db.Doctors.Add(doctor);
     _db.SaveChanges();
     return(RedirectToAction("Details", new { id = doctor.DoctorId }));
 }