예제 #1
0
        // Lists Animals with a given field matching a given value
        public IActionResult Animals(AnimalFieldType column, string value)
        {
            SearchAnimalsViewModel animalsViewModel = new SearchAnimalsViewModel();

            animalsViewModel.Animals = animalData.FindByColumnAndValue(column, value);
            animalsViewModel.Title   = "Animals with " + column + ": " + value;

            return(View(animalsViewModel));
        }
예제 #2
0
        // Process search submission and display search results
        public IActionResult Results(SearchAnimalsViewModel animalsViewModel)
        {
            if (animalsViewModel.Column.Equals(AnimalFieldType.All) || animalsViewModel.Value.Equals(""))
            {
                animalsViewModel.Animals = animalData.FindByValue(animalsViewModel.Value);
            }
            else
            {
                animalsViewModel.Animals = animalData.FindByColumnAndValue(animalsViewModel.Column, animalsViewModel.Value);
            }

            animalsViewModel.Title = "Search";

            return(View("Index", animalsViewModel));
        }