public ActionResult Edit([Bind(Include = "Id,Diagnos,RecordDate")] DocRecord docRecord)
 {
     if (ModelState.IsValid)
     {
         db.Entry(docRecord).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(docRecord));
 }
        public ActionResult Create([Bind(Include = "Id")] DocRecord docRecord)
        {
            if (ModelState.IsValid)
            {
                db.DocRecordSet.Add(docRecord);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(docRecord));
        }
        public ActionResult Create([Bind(Include = "Id,StartTime")] WorkTime workTime)
        {
            if (ModelState.IsValid)
            {
                db.WorkTimeSet.Add(workTime);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(workTime));
        }
        public ActionResult Create([Bind(Include = "Id,FIO,Nation,BirthDate,BirthPlace,LivePlace,Pol")] Person person)
        {
            if (ModelState.IsValid)
            {
                db.PersonSet.Add(person);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(person));
        }
        public ActionResult Create([Bind(Include = "Id,Name")] Illness illness)
        {
            if (ModelState.IsValid)
            {
                db.IllnessSet.Add(illness);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(illness));
        }
        public ActionResult Create([Bind(Include = "Id,Name,Number")] Documents documents)
        {
            if (ModelState.IsValid)
            {
                db.DocumentsSet.Add(documents);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(documents));
        }
示例#7
0
        public ActionResult Create([Bind(Include = "Id,FIO,Nation,BirthDate,BirthPlace,LivePlace,Pol,OMS,Blood,DocType,DocNum")] Patient patient)
        {
            if (ModelState.IsValid)
            {
                db.PatientSet.Add(patient);
                patient.MedCard = new MedCard();
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(patient));
        }
        public ActionResult AddVisit(DoctorFreeTimeViewModel model)
        {
            Patient  patient  = db.PatientSet.Find(model.PatientId);
            WorkTime record   = new WorkTime();
            FreeTime freeTime = db.FreeTimeSet.Find(model.FreeTimeId);
            Doctor   doctor   = db.DoctorSet.Find(model.DoctorId);

            if (patient != null)
            {
                if (ModelState.IsValid && model.DoctorId != -1 && model.FreeTimeId != -1)
                {
                    record.Doctor    = doctor;
                    record.StartTime = freeTime.StartTime;
                    record.Patient   = patient;

                    patient.WorkTime.Add(record);

                    db.FreeTimeSet.Remove(freeTime);

                    db.Entry(patient).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Visits", patient));
                }
            }
            ViewBag.Message = "Выберите врача и время";
            return(RedirectToAction("Visits", patient));
        }
        public ActionResult Create([Bind(Include = "Id,FIO,Nation,BirthDate,BirthPlace,LivePlace,Pol,Job,Insurance,DocType,DocNum")] Doctor doctor)
        {
            if (ModelState.IsValid)
            {
                db.DoctorSet.Add(doctor);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(doctor));
        }
        public ActionResult AddRecord(int patientId, int doctorId, string Diagnos)
        {
            ApplicationUserManager userManager = HttpContext.GetOwinContext()
                                                 .GetUserManager <ApplicationUserManager>();

            var       user    = userManager.FindById(User.Identity.GetUserId());
            Doctor    doctor  = db.DoctorSet.Find(user.PersonId);
            Patient   patient = db.PatientSet.Find(patientId);
            DocRecord record  = new DocRecord();

            record.Diagnos    = Diagnos;
            record.RecordDate = DateTime.Today;
            record.Doctor     = doctor;
            record.MedCard    = patient.MedCard;

            patient.MedCard.DocRecord.Add(record);
            db.SaveChanges();

            return(View("Index"));
        }