Add drop down list filter to search action

Jan 25th, 2014
Price: $40 USD

Question description

The following actions in a controller get the search person page and return the search person results.  At the moment, I have one drop down list filter for the country of birth, one drop down list filter for city and two other search filters by "age" and "gender". I want to add an additional drop down list filter which will allow me to search by hair colour. I am a little bit inexperienced in this area and need some help to be able to do this. 

  /// <summary>
  /// Gets the person search page.
  /// </summary>
  /// <returns>
  /// The person search page.
  /// </returns>
  /// GET: /Person/Search
  public ActionResult Search()
  new PersonSearchViewModel
CountryViewModel =
  new CountryViewModel
Country =
  new SelectList(this.countryManager.GetCountries(), "Name"),
 Cities = new SelectList(new List<City>(), "Name")

  /// <summary>
  /// Searches the person.
  /// </summary>
  /// <param name="viewModel">
  /// The <see cref="PersonSearchViewModel"/> to filter by.
  /// </param>
  /// <returns>
  /// The <see cref="ActionResult"/>.
  /// </returns>
  /// POST: /Person/Search
  public ActionResult Search(PersonSearchViewModel viewModel)
  viewModel.CountryViewModel = new CountryViewModel
 Countries = new SelectList(this.countryManager.GetPCountries(), "Id", "Name"),
 Cities =
  viewModel.SearchCriteria.CountryId > 0
  ? new SelectList(
  : new SelectList(new List<City>(), "Id", "Name")

  viewModel.PersonViewModel = new PersonViewModel
  People = new SelectList(this.personManager.GetAllPeople)),

  if (!this.ModelState.IsValid)
  return this.View(viewModel);

  viewModel.SearchResult = this.peopleManager.FindPeople(viewModel.SearchCriteria, 1234);

  return this.View(viewModel);


Tutor Answer

(Top Tutor) Knowlez
School: UCLA

Studypool has helped 1,244,100 students

Review from student
" Top quality work from this guy! I'll be back! "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1819 tutors are online

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors