public async Task <IActionResult> OnGetFilter(string lang, FilterWordsDTO filterWordsDTO) // if the name is the same as the Page property, // razor will asign whatever was passed to it! { if (!ModelState.IsValid) { Words = new List <Words>(); return(Page()); } if (string.IsNullOrEmpty(filterWordsDTO.Word)) { Words = await _wordsRepository.GetWords(); } else { Words = lang == "g" ? await _wordsRepository.FilterGermanWords(filterWordsDTO) : await _wordsRepository.FilterSerbianWords(filterWordsDTO); } return(Page()); }