コード例 #1
0
        public ActionResult Index(SearchModel aSearchModel)
        {
            Session["DoctorSearchResult"]  = null;
            Session["MedicalSearchResult"] = null;
            Session["SearchKeywords"]      = null;
            if (aSearchModel.SearchDoctor == false)
            {
                ModelState.Remove("SearchDoctor");
            }
            if (aSearchModel.SearchHospital == false)
            {
                ModelState.Remove("SearchHospital");
            }
            if (aSearchModel.SearchBloodDonor == false)
            {
                ModelState.Remove("SearchBloodDonor");
            }
            if (ModelState.IsValid)
            {
                if (aSearchModel.SearchDoctor)
                {
                    List <Doctors>        doctors         = aHomeManager.GetDoctorSearchResult(aSearchModel);
                    List <MedicalAccount> medicalAccounts = new List <MedicalAccount>();
                    aSearchModel.SearchString      = aSearchModel.SearchString;
                    Session["DoctorSearchResult"]  = doctors;
                    Session["MedicalSearchResult"] = medicalAccounts;
                    Session["SearchKeywords"]      = aSearchModel;
                }
                if (aSearchModel.SearchHospital)
                {
                    List <Doctors>        doctors         = new List <Doctors>();
                    List <MedicalAccount> medicalAccounts = aHomeManager.GetHospitalSearchResult(aSearchModel);
                    aSearchModel.SearchString      = aSearchModel.SearchString;
                    Session["MedicalSearchResult"] = medicalAccounts;
                    Session["DoctorSearchResult"]  = doctors;
                    Session["SearchKeywords"]      = aSearchModel;
                }
                if (aSearchModel.SearchBloodDonor)
                {
                    aSearchModel.SearchString = aSearchModel.SearchString;
                }

                return(RedirectToAction("SearchResult", "Home"));
            }
            return(View());
        }