Пример #1
0
        public ActionResult AddDiagnose(int id)
        {
            var model = new DoctorPatientDiagnose();

            model.PatientId = id;
            var    user   = UserManager.FindById(User.Identity.GetUserId());
            Doctor doctor = db.Doctors.Where(z => z.Embg.Equals(user.Embg)).FirstOrDefault();

            model.DoctorId = doctor.Id;
            return(View(model));
        }
Пример #2
0
 public ActionResult AddDiagnose(DoctorPatientDiagnose model)
 {
     if (ModelState.IsValid)
     {
         Diagnose diagnose = new Diagnose();
         diagnose.Date        = model.Date;
         diagnose.Description = model.Description;
         var patient = db.Patients.Where(z => z.Id.Equals(model.PatientId)).FirstOrDefault();
         var doctor  = db.Doctors.Where(z => z.Id.Equals(model.DoctorId)).FirstOrDefault();
         diagnose.Patient = patient;
         diagnose.Doctor  = doctor;
         db.Diagnoses.Add(diagnose);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(model));
 }