public ModelAndViewDTO GetFilteredModelAndView(string inputTitle, string type) { ModelAndViewDTO result = new ModelAndViewDTO { Model = Enumerable.Empty <object>(), View = "NotFound" }; string title = inputTitle.Trim(); if (title.Length <= 0) { return(result); } string[] words = title.ToLower().Split(' '); switch (type) { case "questionType": result = GetQuestionTypeFilteredListAndView(words); break; case "question": result = GetQuestionFilteredListAndView(words); break; case "answer": result = GetAnswerFilteredListAndView(words); break; //case "componentType": // result = GetComponentTypeFilteredListAndVew(words); // break; case "surveyGeography": result = GetSurveyGeographyFilteredListAndView(words); break; case "housingType": result = GetHousingTypeFilteredListAndView(words); break; case "district": result = GetDistrictFilteredListAndView(words); break; case "interviewer": result = GetInterviewerFilteredListAndView(words); break; case "family": result = GetFamilyFilteredListAndView(words); break; case "form": result = GetFormFilteredListAndView(words); break; } return(result); }
public ActionResult AdminSearch(string title, string type) { ModelAndViewDTO result = SearchService.GetFilteredModelAndView(title, type); if (result.Model.Count() > 0) { string modelType = result.Model.First().GetType().ToString().Split('.').Last(); switch (modelType) { case "QuestionTypeDTO": result.Model = Mapper.Map <IEnumerable <QuestionTypeVM> >(result.Model); break; case "QuestionDTO": result.Model = Mapper.Map <IEnumerable <QuestionVM> >(result.Model); break; case "AnswerDTO": result.Model = Mapper.Map <IEnumerable <AnswerVM> >(result.Model); break; //case "ComponentTypeDTO": // result.Model = Mapper.Map<IEnumerable<ComponentTypeVM>>(result.Model); // break; case "SurveyGeographyDTO": result.Model = Mapper.Map <IEnumerable <SurveyGeographyVM> >(result.Model); break; case "HousingTypeDTO": result.Model = Mapper.Map <IEnumerable <HousingTypeVM> >(result.Model); break; case "DistrictDTO": result.Model = Mapper.Map <IEnumerable <DistrictVM> >(result.Model); break; case "InterviewerDTO": result.Model = Mapper.Map <IEnumerable <InterviewerVM> >(result.Model); break; case "FamilyDTO": result.Model = Mapper.Map <IEnumerable <FamilyVM> >(result.Model); break; case "FormDTO": result.Model = Mapper.Map <IEnumerable <FormVM> >(result.Model); break; } } else { result.View = "NotFound"; } return(PartialView(result.View, result.Model)); }
public ModelAndViewDTO GetFilteredModelAndView(string inputTitle, string type) { ModelAndViewDTO result = new ModelAndViewDTO { Model = Enumerable.Empty <object>(), View = "NotFound" }; string title = inputTitle.Trim(); if (title.Length <= 0) { return(result); } string[] words = title.ToLower().Split(' '); switch (type) { case "position": result = GetPositionFilteredListAndView(words); break; case "executorCompany": result = GetExecutorCompanyFilteredListAndView(words); break; case "employee": result = GetEmployeeFilteredListAndView(words); break; case "customer": result = GetCustomerFilteredListAndView(words); break; case "project": result = GetProjectFilteredListAndView(words); break; } return(result); }
public ActionResult SearchMethod(string title, string type) { ModelAndViewDTO result = _searchService.GetFilteredModelAndView(title, type); if (result.Model.Count() > 0) { string modelType = result.Model.First().GetType().ToString().Split('.').Last(); switch (modelType) { case "PositionDTO": result.Model = Mapper.Map <IEnumerable <PositionVM> >(result.Model); break; case "ExecutorCompanyDTO": result.Model = Mapper.Map <IEnumerable <ExecutorCompanyVM> >(result.Model); break; case "EmployeeDTO": result.Model = Mapper.Map <IEnumerable <EmployeeVM> >(result.Model); break; case "CustomerDTO": result.Model = Mapper.Map <IEnumerable <CustomerVM> >(result.Model); break; case "ProjectDTO": result.Model = Mapper.Map <IEnumerable <ProjectVM> >(result.Model); break; } } else { result.View = "NotFound"; } return(PartialView(result.View, result.Model)); }