On a blog page, Subcategories will be linked to the main Category and will be articles of subcategories. Do you think the model structure is correct?
I will develop it with Asp.net Core and EntityFrameworkCore architecture.
public class Category
{
public int Id { get; set; }
public string CategoryName { get; set; }
public bool IsActive { get; set; }
public ICollection<SubCategory> SubCategories { get; set; }
}
--------------------------------------
public class SubCategory
{
public int Id { get; set; }
public string SubCategoryName { get; set; }
public bool IsActive { get; set; }
public int CategoryId { get; set; }
public virtual Category Category { get; set; }
public virtual ICollection<Article> Articles { get; set; }
}
----------------------------------------------
public class Article
{
public int Id { get; set;}
public string ArticleTitle { get; set; }
public string ArticleContent { get; set; }
public DateTime PublishDate { get; set; }
public int AuthorId { get; set; }
public virtual Author Author { get; set; }
public int SubCategoryId { get; set; }
public virtual SubCategory SubCategory { get; set; }
}