RecipeIndexViewModel.cs 881 B

1234567891011121314151617181920
  1. using Recepie.Models;
  2. namespace Recepie.ViewModels
  3. {
  4. public class RecipeIndexViewModel
  5. {
  6. public List<Recipe> Recipes { get; set; } = new List<Recipe>();
  7. public string SearchTerm { get; set; } = string.Empty;
  8. public string IncludeIngredients { get; set; } = string.Empty;
  9. public string ExcludeIngredients { get; set; } = string.Empty;
  10. public string SelectedCategory { get; set; } = string.Empty;
  11. public List<string> Categories { get; set; } = new List<string>();
  12. public int TotalRecipes => Recipes.Count;
  13. public bool HasFilters => !string.IsNullOrEmpty(SearchTerm) ||
  14. !string.IsNullOrEmpty(IncludeIngredients) ||
  15. !string.IsNullOrEmpty(ExcludeIngredients) ||
  16. !string.IsNullOrEmpty(SelectedCategory);
  17. }
  18. }