using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Recepie.Models { public class Recipe { [Key] public int Id { get; set; } [Required] [StringLength(200)] public string Title { get; set; } = string.Empty; [StringLength(1000)] public string? Description { get; set; } [StringLength(50)] public string? Difficulty { get; set; } // Properties that exist in your database - made nullable to handle NULL values public string? Url { get; set; } public string? Time { get; set; } // Navigation properties for ingredients, steps, and images public virtual ICollection RecipeIngredients { get; set; } = new List(); public virtual ICollection RecipeSteps { get; set; } = new List(); // public virtual RecipeImage? RecipeImage { get; set; } // Temporarily disabled for main page performance // Computed property to get ingredient names [NotMapped] public List IngredientNames => RecipeIngredients?.Select(ri => ri.Ingredient?.Name ?? "").Where(name => !string.IsNullOrEmpty(name)).ToList() ?? new List(); } }