示例#1
0
        // GET: SearchbyIndex
        public ActionResult SearchIndex(string searchBy, string searchText, string searchOption, int?id)
        {
            List <SelectListItem> r_statusList = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Text  = "new",
                    Value = "new",
                },
                new SelectListItem()
                {
                    Text  = "Report drafted",
                    Value = "Report drafted",
                },
                new SelectListItem
                {
                    Text  = "Report finalized",
                    Value = "Report finalized",
                }
            };

            ViewBag.ReportStatusSelectList = new SelectList(r_statusList, "Value", "Text");

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            StomatologistViewModel sVM = new StomatologistViewModel();

            if (searchBy == "Patient(First Name)")
            {
                if (searchText == "")
                {
                    sVM.patient_List = db.patients.Where(p => p.specialist_id == id).ToList();
                    sVM.current_user = db.stomatologists.FirstOrDefault(s => s.user_id == id);
                    return(View("Index", sVM));
                }
                sVM.patient_List = db.patients.Where(p => p.specialist_id == id).Where(p => p.first_Name.ToLower() == searchText.ToLower()).ToList();
                sVM.current_user = db.stomatologists.FirstOrDefault(s => s.user_id == id);
                return(View("Index", sVM));
            }
            else
            {
                if (searchOption == "")
                {
                    sVM.patient_List = db.patients.Where(p => p.specialist_id == id).ToList();
                    sVM.current_user = db.stomatologists.FirstOrDefault(s => s.user_id == id);
                    return(View("Index", sVM));
                }
                sVM.patient_List = db.patients.Where(p => p.specialist_id == id).Where(p => p.reports.FirstOrDefault(r => r.patient_id == p.id).status.status1 == searchOption).ToList();
                sVM.current_user = db.stomatologists.FirstOrDefault(s => s.user_id == id);
                return(View("Index", sVM));
            }
        }
示例#2
0
        // GET: stomatologists
        public ActionResult Index(int?id)
        {
            List <SelectListItem> r_statusList = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Text  = "Report drafted",
                    Value = "Report drafted",
                },
                new SelectListItem
                {
                    Text  = "Report finalized",
                    Value = "Report finalized",
                }
            };

            ViewBag.ReportStatusSelectList = new SelectList(r_statusList, "Value", "Text");
            StomatologistViewModel sVM = new StomatologistViewModel();

            sVM.patient_List = db.patients.Where(p => p.specialist_id == id).ToList();
            sVM.current_user = db.stomatologists.FirstOrDefault(s => s.user_id == WebSiteHelper.CurrentUser.id);
            return(View(sVM));
        }