示例#1
0
        public ActionResult CreateByDate(newAnalysis data)
        {
            Pacient pacient = db.pacients.Include(p => p.visits.Select(v => v.analysis)).Include(p => p.doctor).Where(p => p.ID == data.pacientID).FirstOrDefault();

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

            if (visit != null)
            {
                AnalysisType type = db.analysisTypes.Where(a => a.ID == data.analysis.type.ID).First();
                data.analysis.type = type;
                visit.analysis.Add(data.analysis);
                db.SaveChanges();
                return(PartialView("/views/Analyses/pacientDetails.cshtml", data.analysis));
            }
            else
            {
                AnalysisType type = db.analysisTypes.Where(a => a.ID == data.analysis.type.ID).First();
                data.analysis.type = type;
                visit          = new VisitDate();
                visit.doctorID = pacient.doctor.ID;
                visit.date     = data.initialDate;
                visit.analysis = new List <Analysis>();
                visit.analysis.Add(data.analysis);
                pacient.visits.Add(visit);
                db.SaveChanges();
                return(PartialView("/views/Analyses/pacientDetails.cshtml", data.analysis));
            }
            //return PartialView("/views/Assigment/pacientCreate.cshtml", data);
        }
示例#2
0
        public ActionResult Create(newAnalysis data)
        {
            VisitDate visit = db.visits.Include(v => v.analysis).Where(v => v.ID == data.visitID).FirstOrDefault();

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

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

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

            if (ModelState.IsValid)
            {
                AnalysisType type = db.analysisTypes.Where(a => a.ID == data.analysis.type.ID).First();
                data.analysis.type = type;
                visit.analysis.Add(data.analysis);

                db.SaveChanges();
                return(PartialView("/views/Analyses/pacientDetails.cshtml", data.analysis));
            }
            return(PartialView("/views/Analyses/pacientCreate.cshtml", data));
        }
示例#3
0
        public ActionResult pacientCreateByDate(int id)
        {
            newAnalysis na = new newAnalysis();

            na.analysis   = new Analysis();
            na.eventTypes = db.analysisTypes.ToList();
            na.pacientID  = id;
            return(PartialView(na));
        }
示例#4
0
        // GET: Analysis/Create
        public ActionResult pacientCreate(int visitID, int num)
        {
            newAnalysis na = new newAnalysis();

            na.visitID    = visitID;
            na.num        = num;
            na.analysis   = new Analysis();
            na.eventTypes = db.analysisTypes.ToList();
            return(PartialView(na));
        }