Exemplo n.º 1
0
        public ActionResult CreateByDate(newNeurostatus data)
        {
            Pacient pacient = db.pacients.Include(p => p.visits.Select(v => v.neurostatuses)).Include(p => p.doctor).Where(p => p.ID == data.pacientID).First();

            if (pacient == null)
            {
                return(RedirectToAction("Index", "Pacients"));
            }
            VisitDate visit = pacient.visits.Where(v => v.date == data.initialDate).FirstOrDefault();

            if (visit != null)
            {
                NeuroStatusType type = db.neuroStatusTypes.Where(a => a.ID == data.neurostatus.type.ID).First();
                data.neurostatus.type = type;
                visit.neurostatuses.Add(data.neurostatus);
                db.SaveChanges();
                return(PartialView("/views/Neurostatus/pacientDetails.cshtml", data.neurostatus));
            }
            else
            {
                NeuroStatusType type = db.neuroStatusTypes.Where(a => a.ID == data.neurostatus.type.ID).First();
                data.neurostatus.type = type;
                visit               = new VisitDate();
                visit.doctorID      = pacient.doctor.ID;
                visit.date          = data.initialDate;
                visit.neurostatuses = new List <Neurostatus>();
                visit.neurostatuses.Add(data.neurostatus);
                pacient.visits.Add(visit);
                db.SaveChanges();
                return(PartialView("/views/Neurostatus/pacientDetails.cshtml", data.neurostatus));
            }
            //return PartialView("/views/Assigment/pacientCreate.cshtml", data);
        }
Exemplo n.º 2
0
        public ActionResult Create(newNeurostatus data)
        {
            VisitDate visit = db.visits.Include(v => v.neurostatuses).Where(v => v.ID == data.visitID).First();

            if (visit == null)
            {
                return(RedirectToAction("Index", "Pacients"));
            }

            Pacient pacient = db.pacients.Where(p => p.visits.Any(v => v.ID == data.visitID)).First();

            if (pacient == null)
            {
                return(RedirectToAction("Index", "Pacients"));
            }

            if (ModelState.IsValid)
            {
                NeuroStatusType type = db.neuroStatusTypes.Where(a => a.ID == data.neurostatus.type.ID).First();
                data.neurostatus.type = type;
                visit.neurostatuses.Add(data.neurostatus);

                db.SaveChanges();
                return(PartialView("/views/Neurostatus/pacientDetails.cshtml", data.neurostatus));
            }
            return(PartialView("/views/Neurostatus/pacientCreate.cshtml", data));
        }
Exemplo n.º 3
0
        public ActionResult pacientCreateByDate(int id)
        {
            newNeurostatus na = new newNeurostatus();

            na.neurostatus = new Neurostatus();
            na.eventTypes  = db.neuroStatusTypes.ToList();
            na.pacientID   = id;
            return(PartialView(na));
        }
Exemplo n.º 4
0
        // GET: Neurostatus/Create
        public ActionResult pacientCreate(int visitID, int num)
        {
            newNeurostatus na = new newNeurostatus();

            na.visitID     = visitID;
            na.num         = num;
            na.neurostatus = new Neurostatus();
            na.eventTypes  = db.neuroStatusTypes.ToList();
            return(PartialView(na));
        }