Exemplo n.º 1
0
        public ActionResult Search(SearchFormViewModel searchParameters)
        {
            if (ModelState.IsValid == false)
            {
                this.Flash(Toastr.ERROR, "Error", "Enter search pattern!");
                return(RedirectToAction("SearchForm", "Search"));
            }

            string[] phrases = searchParameters.SearchPattern.Split('"');

            //svaki neparni index u phrases je razmak, pa ga mičemo
            IEnumerable <string[]> removeBlank = phrases.Select((item, index) => index % 2 == 0 ?
                                                                item.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                                                            : new[] { item });
            List <string> pattern = removeBlank.SelectMany(element => element).ToList();

            string tsPattern = ConvertTo.LogicalPattern(pattern, searchParameters.LogicalOperator == (int)Operator.Or ? Operator.Or : Operator.And);

            string queryString;
            List <MovieViewModel> movies = TextSearch.MorphologySemantic(tsPattern, out queryString);

            var viewModel = new SearchFormViewModel()
            {
                SearchPattern   = searchParameters.SearchPattern,
                LogicalOperator = searchParameters.LogicalOperator,
                QueryString     = queryString,
                Movies          = movies
            };

            UpdateSearchHistory(tsPattern);

            ModelState.Clear(); //bez ovoga ne bi se mijenjao QueryString
            return(View("SearchForm", viewModel));
        }
        public ActionResult Result(SearchFormViewModel searchForm)
        {
            SearchResultsViewModel results = searchFormManager.Search(searchForm);

            Session["currentSearch"] = results;
            return(View(results));
        }
Exemplo n.º 3
0
        public ActionResult Search(SearchFormViewModel search)
        {
            try
            {
                int skip = search.Page * search.PageSize;
                int take = search.PageSize;

                var searchViewModel = new SearchViewModel
                {
                    CategoryId = search.CategoryId,
                    Keywords   = search.Keywords,
                    Query      = search.Query
                };

                var result = donationBLO.Search(searchViewModel, skip, take);

                search.Requests    = result.Requests;
                search.Quantity    = result.Quantity;
                search.NumberPages = result.Quantity / search.PageSize;

                if (result.Quantity % search.PageSize > 0)
                {
                    search.NumberPages++;
                }

                return(View("Result", search));
            }
            catch (Exception ex)
            {
                ErrorHandling.AddModelError(ModelState, ex);
                return(View());
            }
        }
Exemplo n.º 4
0
        public ActionResult Search(SearchFormViewModel searchModel)
        {
            searchModel.Accommodations = _db.Accommodations.ToList();
            searchModel.Bookings       = _db.Bookings.ToList();
            searchModel.Availabilities = _db.Availabilities.ToList();

            var searchResults = _db.Accommodations.ToList();



            if (searchModel.SearchLocation != null)
            {
                searchResults = searchResults
                                .Where(a => a.Location == searchModel.SearchLocation).ToList();
            }

            if (searchModel.SearchOccupancy != null)
            {
                searchResults = searchResults
                                .Where(a => a.Occupancy >= searchModel.SearchOccupancy).ToList();
            }

            if (searchModel.SearchArrival != null && searchModel.SearchDeparture != null)
            {
                Session["Dates"] = new DatesViewModel
                {
                    SearchArrival   = searchModel.SearchArrival,
                    SearchDeparture = searchModel.SearchDeparture
                };
                //Implement availability

                foreach (var accommodation in searchResults.ToList())
                {
                    var accommodationBookings = searchModel.Bookings.Where(b => b.AccommodationId == accommodation.Id);


                    foreach (var booking in accommodationBookings)
                    {
                        if (searchModel.SearchArrival <= booking.Departure && searchModel.SearchDeparture >= booking.Arrival)
                        {
                            searchResults.Remove(accommodation);
                            break;
                        }
                    }


                    var accommodationAvailabilities = searchModel.Availabilities.Where(b => b.AccommodationId == accommodation.Id);

                    foreach (var availability in accommodationAvailabilities)
                    {
                        if (searchModel.SearchArrival <= availability.AvailabilityStart && searchModel.SearchDeparture >= availability.AvailabilityEnd)
                        {
                            searchResults.Remove(accommodation);
                            break;
                        }
                    }
                }
            }
            return(View(searchResults));
        }
Exemplo n.º 5
0
        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            var viewModel = new SearchFormViewModel(manufacturers);

            return(View(viewModel));
        }
Exemplo n.º 6
0
        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";


            var viewModel = new SearchFormViewModel(manufacturers);

            return(View(viewModel));
        }
        public ActionResult Index()
        {
            if (Session["currentSearch"] != null)
            {
                Session.Remove("currentSearch");
            }
            SearchFormViewModel searchForm = searchFormManager.NewSearchForm();

            return(View(searchForm));
        }
Exemplo n.º 8
0
        public ActionResult Index_Post(SearchFormViewModel model)
        {
            if (ModelState.IsValid)
            {
                var searchEngine = _searchEngines.FirstOrDefault(e => e.Name == model.SearchEngine);
                if (searchEngine != null)
                {
                    return(Redirect(searchEngine.GenerateSearchUri(model.SearchTerm).ToString()));
                }
            }

            return(View(model));
        }
Exemplo n.º 9
0
        public void IndexWithParamTest()
        {
            var controller = new HomeController(_factory, _mapper);
            var form       = new SearchFormViewModel()
            {
                CityName    = "Lviv",
                ResultCount = 3
            };

            var result      = controller.Index(form).Result as ViewResult;
            var actualCount = (result.Model as ComplexViewModel).Result.Units.Count;

            Assert.AreEqual(actualCount, 3);
        }
Exemplo n.º 10
0
        public SearchResultsViewModel Search(SearchFormViewModel queryForm)
        {
            SearchResultsViewModel returnForm = new SearchResultsViewModel();

            returnForm.SearchQuery       = queryForm.SearchQuery;
            returnForm.SearchCategory    = queryForm.SearchCategory;
            returnForm.SearchSubcategory = queryForm.SearchSubcategory;
            returnForm.TradeCategory     = queryForm.TradeCategory;
            returnForm.TradeSubcategory  = queryForm.TradeSubcategory;
            returnForm.State             = queryForm.State;
            returnForm.City    = queryForm.City;
            returnForm.Results = GetSearchResults(returnForm, 0);
            return(returnForm);
        }
Exemplo n.º 11
0
        public IActionResult Do(SearchFormViewModel model)
        {
            try
            {
                if (string.IsNullOrEmpty(model.SearchKeyword))
                {
                    return(RedirectToAction("Index", "Home"));
                }

                var articlePrefix = _settingService.GetSettings().ArticlePrefix;
                if (!string.IsNullOrEmpty(articlePrefix))
                {
                    if (model.SearchKeyword.Length > articlePrefix.Length + 1 &&
                        model.SearchKeyword.Substring(0, articlePrefix.Length + 1) == articlePrefix + "-")
                    {
                        var articleId = model.SearchKeyword.Substring(articlePrefix.Length + 1);
                        model.ArticleId = Convert.ToInt32(articleId);
                    }

                    if (model.ArticleId > 0)
                    {
                        Article article = new Article();

                        article = PublishedArticles().FirstOrDefault(a => a.Id == model.ArticleId);


                        if (article != null)
                        {
                            return(RedirectToRoute("Default", new { controller = "Home", action = "Detail", id = article.SefName }));
                        }
                    }
                }

                if (model.CurrentPage == 0)
                {
                    model.CurrentPage++;
                }

                //model.Results = KbVaultLuceneHelper.DoSearch(_env, model.SearchKeyword, model.CurrentPage, 10);
                model.Results = _lucene.DoSearch(model.SearchKeyword, model.CurrentPage, 10);

                return(View(model));
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }
Exemplo n.º 12
0
        public IActionResult Search(SearchFormViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            var s = new Search();

            s.Name     = model.Name;
            s.LastName = model.LastName;

            //Add to DB
            _context.Forms.Add(s);
            _context.SaveChanges();
            return(RedirectToAction("index"));
        }
Exemplo n.º 13
0
        public ActionResult Do(SearchFormViewModel model)
        {
            try
            {
                if (string.IsNullOrEmpty(model.SearchKeyword))
                {
                    return(RedirectToAction("Index", "Home"));
                }
                string articlePrefix = Settings.ArticlePrefix;
                if (!string.IsNullOrEmpty(articlePrefix))
                {
                    if (model.SearchKeyword.Length > articlePrefix.Length + 1 &&
                        model.SearchKeyword.Substring(0, articlePrefix.Length + 1) == articlePrefix + "-")
                    {
                        string articleId = model.SearchKeyword.Substring(articlePrefix.Length + 1);
                        model.ArticleId = Convert.ToInt32(articleId);
                    }

                    if (model.ArticleId > 0)
                    {
                        Article article = null;
                        using (var db = new KbVaultContext())
                        {
                            article = db.PublishedArticles().FirstOrDefault(a => a.Id == model.ArticleId);
                        }
                        if (article != null)
                        {
                            return(RedirectToRoute("Default", new { controller = "Home", action = "Detail", id = article.SefName }));
                        }
                    }
                }
                if (model.CurrentPage == 0)
                {
                    model.CurrentPage++;
                }
                //TODO: Make result count configurable
                model.Results = KbVaultLuceneHelper.DoSearch(model.SearchKeyword, model.CurrentPage, 10);

                return(View(model));
            }catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }
Exemplo n.º 14
0
        public JsonResult More(SearchFormViewModel model)
        {
            JsonOperationResponse result = new JsonOperationResponse();

            try
            {
                model.CurrentPage++;
                model.Results     = KbVaultLuceneHelper.DoSearch(model.SearchKeyword, model.CurrentPage, 1);
                result.Successful = true;
                result.Data       = model;
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                result.ErrorMessage = ex.Message;
            }
            return(Json(result));
        }
Exemplo n.º 15
0
        public ActionResult Search(SearchFormViewModel model)
        {
            if (!ModelState.IsValid || Context.PageMode.IsExperienceEditor)
            {
                return(View("~/Areas/Search/Views/Search.cshtml", model));
            }

            var searchPage = _searchConfigurationService.GetSearchPage();

            if (searchPage != null)
            {
                var redirectUrl = $"{LinkManager.GetItemUrl(searchPage)}?query={model.SearchTerm}";
                return(Redirect(redirectUrl));
            }


            return(Redirect("/"));
        }
Exemplo n.º 16
0
        public SearchFormViewModel NewSearchForm()
        {
            string emailAddress = HttpContext.Current.User.Identity.Name.ToString();

            if (!global.IsUniqueEmailAddress(emailAddress))
            {
                Account             userAccount = global.GetAccount(emailAddress);
                SearchFormViewModel newForm     = new SearchFormViewModel(userAccount.State);
                newForm.CategoriesList = global.GetCategoryList();
                newForm.City           = userAccount.City;
                if (newForm.CategoriesList == null)
                {
                    return(null);
                }
                newForm.SubcategoriesList = global.GetSubCategoryList();
                return(newForm);
            }
            return(null);
        }
Exemplo n.º 17
0
 public IActionResult Search(SearchFormViewModel model, int page = 1)
 => View(new WantedPeoplePageListingModel
 {
     CurrentPage  = page,
     WantedPeople = this.peopleService.SearchByComponents(
         model.EnableCountrySearch,
         model.SelectedCountryId ?? 0,
         model.EnableGenderSearch,
         model.SelectedGender,
         model.SearchByFirstName,
         model.SearchByLastName,
         model.SearchByDistinguishMarks,
         model.SearchByAge ?? 0,
         page,
         PageSize),
     SearchCriteriaTotalPages = this.peopleService.SearchPeopleCriteriaCounter,
     TotalPages = (int)Math.Ceiling(this.peopleService.SearchPeopleCriteriaCounter / (double)PageSize),
     Articles   = articleService.LastSixArticles()
 });
Exemplo n.º 18
0
        public ActionResult Index()
        {
            if (!_searchEngines.Any())
            {
                return(RedirectToAction("NoSearchEnginesInstalled"));
            }

            var viewModel = new SearchFormViewModel();

            viewModel.SearchTerm             = "";
            viewModel.SearchEngine           = _searchEngines.Select(e => e.Name).FirstOrDefault();
            viewModel.AvailableSearchEngines = _searchEngines.Select(
                e => new SelectListItem()
            {
                Text  = e.Name,
                Value = e.Name
            }).ToList();

            return(View(viewModel));
        }
Exemplo n.º 19
0
        public async Task <ActionResult> Index(SearchFormViewModel model)
        {
            try
            {
                var resultModel = new ComplexViewModel();
                resultModel.Form = model;
                ForecastDTO forecastDTO = null;
                if (ModelState.IsValid)
                {
                    forecastDTO = await WeatherService.GetWeatherDaily(model.CityName, model.ResultCount);
                }

                if (forecastDTO != null)
                {
                    var forecast = _mapper.Map <ForecastViewModel>(forecastDTO);
                    resultModel.Result = forecast;
                    var cookie = Request?.Cookies["Id"];
                    if (cookie != null)
                    {
                        await HistoryService.SaveToHistory(forecastDTO, Convert.ToInt32(cookie.Value));
                    }
                    else
                    {
                        var id = await HistoryService.SaveToHistory(forecastDTO);

                        cookie       = new HttpCookie("Id");
                        cookie.Value = id.ToString();
                        Response?.SetCookie(cookie);
                    }
                    return(View(resultModel));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
Exemplo n.º 20
0
        protected override DriverResult Editor(SearchFormPart part, IUpdateModel updater, dynamic shapeHelper)
        {
            return(ContentShape("Parts_Search_SearchForm_Edit", () => {
                var viewModel = new SearchFormViewModel {
                    OverrideIndex = part.OverrideIndex,
                    AvailableIndexes = _indexManager.GetSearchIndexProvider().List().ToList(),
                    SelectedIndex = part.SelectedIndex
                };

                if (updater != null)
                {
                    if (updater.TryUpdateModel(viewModel, Prefix, null, new[] { "AvailableIndexes" }))
                    {
                        part.OverrideIndex = viewModel.OverrideIndex;
                        part.SelectedIndex = viewModel.SelectedIndex;
                    }
                }

                return shapeHelper.EditorTemplate(TemplateName: "Parts/Search.SearchForm", Model: viewModel, Prefix: Prefix);
            }));
        }
Exemplo n.º 21
0
        public async Task <ActionResult> ParseUrl([FromBody] SearchFormViewModel searchFormViewModel)
        {
            try
            {
                YoutubeLogic   YLogic         = new YoutubeLogic();
                VideoViewModel videoViewModel = await YLogic.GetVideoInfoByUrl(searchFormViewModel.youtubeUrl);

                var result = await _viewRenderService.RenderToStringAsync("_VideoResult", videoViewModel);

                return(Json(new
                {
                    status = true,
                    videoViewModel = videoViewModel,
                    partialViewData = Content(result)
                }));
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
                return(Json(new { status = false, message = ex.Message }));
            }
        }
Exemplo n.º 22
0
        public async Task <ActionResult> DownloadAudioFile([FromBody] SearchFormViewModel searchFormViewModel)
        {
            try
            {
                YoutubeLogic       YLogic             = new YoutubeLogic();
                AudioFileViewModel audioFileViewModel = await YLogic.DownloadAudioByUrl(searchFormViewModel.youtubeUrl);

                audioFileViewModel.fileWebsitePath = Request.Scheme + "://" + Request.Host + Request.PathBase + "/Downloads/Audio/" + audioFileViewModel.fileName;
                var result = await _viewRenderService.RenderToStringAsync("_AudioResult", audioFileViewModel);

                return(Json(new
                {
                    status = true,
                    audioFileViewModel = audioFileViewModel,
                    partialViewData = Content(result)
                }));
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
                return(Json(new { status = false, message = ex.Message }));
            }
        }
Exemplo n.º 23
0
        public async Task <IActionResult> IndexAsync(SearchFormViewModel searchFormVM = null)
        {
            // récupération de l'utilisateur connecté
            Utilisateur utilisateur = null;

            if (HttpContext.Session.GetInt32("userId") != null && HttpContext.Session.GetInt32("userId") > 0) //HttpContext.Request.Cookies.ContainsKey("userId")
            {
                int idUtilisateur = (int)HttpContext.Session.GetInt32("userId");                              //Convert.ToInt32(HttpContext.Request.Cookies["userId"]);
                utilisateur = _db.Utilisateurs.Single(utilisateur => utilisateur.Id == idUtilisateur);
            }


            // récupération des informations renseignées dans le formulaire de recherche
            int    nbPersonnes   = searchFormVM.NbPersonnes;
            String ville         = searchFormVM.Ville;
            int    idDepartement = Convert.ToInt32(searchFormVM.Departement);


            // récupération de liste de logements à réserver (avec Adresse et Département d'un logement)
            var logements = _db.Logements.AsQueryable();

            // car je veux pas pouvoir louer mes propres logements
            if (utilisateur != null)
            {
                logements = logements.Where(logement => logement.Proprietaire.Id != utilisateur.Id);
            }

            if (nbPersonnes > 0)
            {
                logements = logements.Where(logement => logement.NbPersonnes == searchFormVM.NbPersonnes);
            }
            if (!String.IsNullOrEmpty(ville))
            {
                logements = logements.Where(logement => logement.Adresse.Ville == searchFormVM.Ville);
            }
            if (idDepartement > 0)
            {
                logements = logements.Where(logement => logement.Adresse.Departement.Id == Convert.ToInt32(searchFormVM.Departement));
            }

            logements = logements
                        .Include(logement => logement.Adresse)        // récupère aussi des infos sur Adresse (aggrégation)
                        .ThenInclude(adresse => adresse.Departement); // et ensuite relation Adresse - Département


            // récupération des départements si la liste n'a pas encore été initialisée
            bool isDepartementInDatabase = _db.Departements.Any();

            if (!isDepartementInDatabase)
            {
                await GetDepartementsAsync();
            }

            List <Logement>    mesLogements    = null;
            List <Reservation> mesReservations = null;

            if (utilisateur != null)
            {
                mesLogements    = getMesLogements(utilisateur.Id);
                mesReservations = getMesReservations(utilisateur.Id);
            }

            ViewData["logements"]       = new List <Logement>(logements);
            ViewData["mesLogements"]    = mesLogements;
            ViewData["mesReservations"] = mesReservations;
            ViewData["departements"]    = GetDepartements();
            return(View());
        }
Exemplo n.º 24
0
 public async Task <IActionResult> SearchQuery([FromBody] SearchFormViewModel model)
 {
     // logic for search, depends of the use case
     // for example general search or search in users only (see the SearchFormViewModel has EnableSearchInUsers)
     return(this.Ok());
 }
Exemplo n.º 25
0
        public ActionResult Search(SearchFormViewModel obj)
        {
            var ageFilteredValues   = GetAgeFilteredValuesByExpression(obj.AgeExpression, obj.Age);
            var housesByPrecinct    = obj.PrecinctId.HasValue ? GetHousesByPrecinctId(obj.PrecinctId.Value) : new List <int>();
            var voterPartyRelations = dataManager.VoterPartyRelations.GetAll().Where(x => x.PartyId == obj.PartyId);
            var result = from v in dataManager.Voters.GetAll().Select(x => new VoterViewModel
            {
                Voter  = x,
                Person = dataManager.Persons.Get(x.PersonId ?? 0)
            })
                         where (v.Person.LastName ?? "").ToLowerInvariant().StartsWith((obj.LastName ?? "").ToLowerInvariant()) &&
                         (v.Person.FirstName ?? "").ToLowerInvariant().StartsWith((obj.FirstName ?? "").ToLowerInvariant()) &&
                         (v.Person.MiddleName ?? "").ToLowerInvariant().StartsWith((obj.MiddleName ?? "").ToLowerInvariant()) &&
                         (obj.GaveBiometricData == SearchFormViewModel.GaveBiometricDataType.yes ? v.Voter.GaveBiometricData : (obj.GaveBiometricData == SearchFormViewModel.GaveBiometricDataType.no ? !v.Voter.GaveBiometricData : true))
                         //filtering by living address
                         && (obj.DistrictId.HasValue ? v.Person.DistrictId == obj.DistrictId : true) &&
                         (obj.LocalityId.HasValue ? obj.LocalityId.Value == v.Person.LocalityId : true) &&
                         (obj.StreetId.HasValue ? obj.StreetId.Value == v.Person.StreetId : true) &&
                         (obj.HouseId.HasValue ? obj.HouseId.Value == v.Person.HouseId : true)
                         //filtering by party
                         && (obj.PartyId.HasValue ? voterPartyRelations.Select(x => x.VoterId).Contains(v.Voter != null ? v.Voter.Id : 0) : true)
                         //filtering by age
                         && (obj.Age.HasValue ? (ageFilteredValues.Contains(v.Person.Years ?? 0)) : true)
                         //filtering by precinct point in house
                         && (obj.PrecinctId.HasValue ? (housesByPrecinct.Contains(v.Person.HouseId ?? 0)) : true)
                         select v;
            var districts = new List <SelectListItem> {
                new SelectListItem()
            };

            districts.AddRange(from d in dataManager.Districts.GetAll()
                               select new SelectListItem
            {
                Text  = d.Name,
                Value = d.Id.ToString()
            });
            ViewBag.Districts = districts;

            ViewBag.Locality = dataManager.Localities.Get(obj.LocalityId ?? 0);

            ViewBag.Street = dataManager.Streets.Get(obj.StreetId ?? 0);

            ViewBag.House = dataManager.Houses.Get(obj.HouseId ?? 0);

            var parties = new List <SelectListItem> {
                new SelectListItem()
            };

            parties.AddRange(from p in dataManager.Parties.GetAll()
                             select new SelectListItem
            {
                Text  = p.Name,
                Value = p.Id.ToString()
            });
            ViewBag.Parties = parties;

            var precincts = new List <SelectListItem> {
                new SelectListItem()
            };

            precincts.AddRange(from p in dataManager.Precincts.GetAll().OrderBy(x => x.Name)
                               select new SelectListItem
            {
                Text  = p.Name,
                Value = p.Id.ToString()
            });
            ViewBag.Precincts = precincts;

            obj.SearchResult = result.ToList();
            return(View(obj));
        }
Exemplo n.º 26
0
        public List <Employee> SearchActiveEmployees(SearchFormViewModel searchForm)
        {
            var employeesList = _employeeDataAccess.GetActiveEmployees();

            if (searchForm.Gender != null)
            {
                var emps = _employeeDataAccess.GetEmployeesByGender(searchForm.Gender);
                employeesList = employeesList.Intersect(emps).ToList();
            }
            if (searchForm.StartingBirthDate != null)
            {
                if (searchForm.EndingBirthDate == null)
                {
                    searchForm.EndingBirthDate = DateTime.Now;
                }
                var emps = _employeeDataAccess.GetEmployeesByBirthDateInterval((DateTime)searchForm.StartingBirthDate, (DateTime)searchForm.EndingBirthDate);
                employeesList = employeesList.Intersect(emps).ToList();
            }
            if (searchForm.StartingHiringDate != null)
            {
                if (searchForm.EndingHiringDate == null)
                {
                    searchForm.EndingHiringDate = DateTime.Now;
                }
                var emps = _employeeDataAccess.GetEmployeesByHiringDateInterval((DateTime)searchForm.StartingHiringDate, (DateTime)searchForm.EndingHiringDate);
                employeesList = employeesList.Intersect(emps).ToList();
            }
            if (searchForm.GraduationYear != null)
            {
                var emps = _employeeDataAccess.GetAllEmployees().Where(employee => searchForm.GraduationYear.Any(condition => employee.GraduationYear == condition)).ToList();
                employeesList = employeesList.Intersect(emps).ToList();
            }

            if (searchForm.MajorUniversity != null)
            {
                var emps = _employeeDataAccess.GetAllEmployees().Where(employee => searchForm.MajorUniversity.Any(condition => employee.MajorUniversity == condition)).ToList();
                employeesList = employeesList.Intersect(emps).ToList();
            }
            if (searchForm.WorkloadId != null)
            {
                var emps = _employeeDataAccess.GetAllEmployees().Where(employee => searchForm.WorkloadId.Any(condition => employee.WorkloadId == condition)).ToList();
                employeesList = employeesList.Intersect(emps).ToList();
            }
            if (searchForm.RoleId != null)
            {
                var emps = _employeeDataAccess.GetAllEmployees().Where(employee => searchForm.RoleId.Any(condition => employee.RoleId == condition)).ToList();
                employeesList = employeesList.Intersect(emps).ToList();
            }
            if (searchForm.Subsidiary != null)
            {
                var emps = _employeeDataAccess.GetAllEmployees().Where(employee => searchForm.Subsidiary.Any(condition => employee.Subsidiary == condition)).ToList();
                employeesList = employeesList.Intersect(emps).ToList();
            }
            if (searchForm.Vendor != null)
            {
                var emps = _employeeDataAccess.GetAllEmployees().Where(employee => searchForm.Vendor.Any(condition => employee.Vendor == condition)).ToList();
                employeesList = employeesList.Intersect(emps).ToList();
            }
            if (searchForm.BasedOut != null)
            {
                var emps = _employeeDataAccess.GetAllEmployees().Where(employee => searchForm.BasedOut.Any(condition => employee.BasedOut == condition)).ToList();
                employeesList = employeesList.Intersect(emps).ToList();
            }
            if (searchForm.ReportingManager != null)
            {
                var emps = _employeeDataAccess.GetAllEmployees().Where(employee => searchForm.ReportingManager.Any(condition => employee.ReportingManager == condition)).ToList();
                employeesList = employeesList.Intersect(emps).ToList();
            }
            if (searchForm.ExperienceYears != null)
            {
                var emps = _employeeDataAccess.GetAllEmployees().Where(employee => searchForm.ExperienceYears.Any(condition => employee.ExperienceYears == condition)).ToList();
                employeesList = employeesList.Intersect(emps).ToList();
            }
            if (searchForm.PreviousEmployer != null)
            {
                var emps = _employeeDataAccess.GetAllEmployees().Where(employee => searchForm.PreviousEmployer.Any(condition => employee.PreviousEmployer == condition)).ToList();
                employeesList = employeesList.Intersect(emps).ToList();
            }

            return(employeesList);
        }
Exemplo n.º 27
0
 public ActionResult SearchCars(SearchFormViewModel sModel)
 {
     return(View("Index", sModel));
 }
Exemplo n.º 28
0
 // GET: Search
 public ActionResult Index(SearchFormViewModel sModel)
 {
     return(View());
 }
Exemplo n.º 29
0
        public ActionResult SearchForm()
        {
            var viewModel = new SearchFormViewModel();

            return(View("SearchForm", viewModel));
        }
Exemplo n.º 30
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var model = new SearchFormViewModel();

            return(View("SearchForm", model));
        }