Beispiel #1
0
        public ActionResult Add(int?appointmentID, int?examID, string examDetails, bool examSend)
        {
            if (appointmentID == null || examID == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            db.Configuration.ProxyCreationEnabled = false;
            Appointment appointment = db.Appointments.Find(appointmentID);
            Exam        exam        = db.Exams.Find(examID);

            if (appointment == null || exam == null)
            {
                return(HttpNotFound());
            }
            PrescriptedExam prescriptedExam = new PrescriptedExam();

            prescriptedExam.AppointmentID = appointment.AppointmentID;
            prescriptedExam.ExamID        = exam.ExamID;
            prescriptedExam.PatientID     = appointment.PatientID;
            prescriptedExam.PhysicianID   = appointment.PhysicianID;
            prescriptedExam.Details       = examDetails;
            prescriptedExam.SendToPacient = examSend;
            prescriptedExam.StatusID      = Constants.SS_EX_REQUESTED;

            db.PrescriptedExams.Add(prescriptedExam);
            db.SaveChanges();

            //return View();
            return(Json(prescriptedExam.PrescriptedExamID, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        //[ValidateAntiForgeryToken]
        public ActionResult SaveExamResult(int?prescriptedExamID, string examResult)
        {
            if (prescriptedExamID == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PrescriptedExam prescriptedExam = db.PrescriptedExams.Find(prescriptedExamID);

            if (prescriptedExam == null)
            {
                return(HttpNotFound());
            }

            if (ModelState.IsValid)
            {
                prescriptedExam.Result          = examResult;
                prescriptedExam.ResultDate      = DateTime.Now;
                prescriptedExam.StatusID        = Constants.SS_EX_FINISHED;
                db.Entry(prescriptedExam).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Details", new { id = prescriptedExam.PrescriptedExamID }));
            }

            return(View(prescriptedExam));
        }
Beispiel #3
0
        //[ValidateAntiForgeryToken]
        public ActionResult DeleteConfirmed(int id)
        {
            PrescriptedExam prescriptedExam = db.PrescriptedExams.Find(id);

            db.PrescriptedExams.Remove(prescriptedExam);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #4
0
        public ActionResult Create([Bind(Include = "PrescriptedExamID,AppointmentID,PhysicianID,PatientID,ExamID,Details,ResultDate,Result,SendToPacient,StatusID")] PrescriptedExam prescriptedExam)
        {
            if (ModelState.IsValid)
            {
                db.PrescriptedExams.Add(prescriptedExam);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(prescriptedExam));
        }
Beispiel #5
0
        // GET: PrescriptedExams/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PrescriptedExam prescriptedExam = db.PrescriptedExams.Find(id);

            if (prescriptedExam == null)
            {
                return(HttpNotFound());
            }
            return(View(prescriptedExam));
        }
Beispiel #6
0
        // GET: PrescriptedExams/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PrescriptedExam prescriptedExam = db.PrescriptedExams.Find(id);

            if (prescriptedExam == null)
            {
                return(HttpNotFound());
            }

            var physicians   = new SelectList(db.Physicians, "PhysicianID", "PhysicianID");
            var usPhysicians = new SelectList(db.AppUsers, "AppUserID", "FullName").Where(u => physicians.Any(p => p.Value == u.Value));

            ViewBag.ExamID      = new SelectList(db.Exams, "ExamID", "Name", prescriptedExam.ExamID);
            ViewBag.PhysicianID = usPhysicians;
            return(View(prescriptedExam));
        }
Beispiel #7
0
        //[ValidateAntiForgeryToken]
        //public ActionResult Edit([Bind(Include = "PrescriptedMedicineID,AppointmentID,PhysicianID,PatientID,MedicineID,Posology")] PrescriptedMedicine prescriptedMedicine)
        public ActionResult Edit(int?id, string examDetails, bool examSend)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PrescriptedExam prescriptedExam = db.PrescriptedExams.Find(id);

            if (prescriptedExam == null)
            {
                return(HttpNotFound());
            }

            prescriptedExam.Details       = examDetails;
            prescriptedExam.SendToPacient = examSend;

            db.Entry(prescriptedExam).State = EntityState.Modified;
            db.SaveChanges();

            //return RedirectToAction("Index");
            return(Json(prescriptedExam.PrescriptedExamID, JsonRequestBehavior.AllowGet));
        }