public IActionResult List(string categoryName) { IEnumerable <Snack> snacks; if (string.IsNullOrWhiteSpace(categoryName)) { categoryName = "Todos os produtos"; snacks = _snackRepository.GetSnacks(); } else { snacks = _snackRepository.GetSnacks(categoryName: categoryName); } snacks.SetImages(_imagesManagement); var snackListViewModel = new SnackListViewModel { Snacks = snacks, CurrentCategory = categoryName }; return(View(snackListViewModel)); }