public ActionResult Search(SearchDataViewModel searchDataViewModel) { if (!IsSearchDataViewModelValid(searchDataViewModel)) { SetNotification(NotificationType.Error, "Some of the input data are invalid."); return FailureJsonResult(); } IEnumerable<MedicalType> selectedMedicalTypes = searchDataViewModel.GetSelectedMedicalTypes(); searchDataViewModel.SearchData.SearchedMedicalTypes = selectedMedicalTypes; SessionManager.LastSearchData = searchDataViewModel.SearchData; return ProcessCommandData(searchDataViewModel.SearchData, () => Json(LastCommandResult, JsonRequestBehavior.AllowGet)); }
private bool IsSearchDataViewModelValid(SearchDataViewModel searchDataViewModel) { return ModelState.IsValid && searchDataViewModel.GetSelectedMedicalTypes().Any(); }