public class CategoryViewFactory : ICategoryViewFactory
{
private readonly ActiveProgressions _activeProgressions;
public CategoryViewFactory(ActiveProgressions activeProgressions)
{
_activeProgressions = activeProgressions;
}
public ICategoryView? Create(CategoryType type, Category category)
{
return type switch
{
CategoryType.Category => new CategoryView(category),
CategoryType.Subcategory => new SubcategoryView(category, _activeProgressions),
_ => null
};
}
}
public class CategoryViewFactory : ICategoryViewFactory
{
private readonly ActiveProgressions _activeProgressions;
public CategoryViewFactory(ActiveProgressions activeProgressions)
{
_activeProgressions = activeProgressions;
}
public ICategoryView? Create(CategoryType type, Category category)
{
return type switch
{
CategoryType.Category => new CategoryView(category),
CategoryType.Subcategory => new SubcategoryView(category, _activeProgressions),
_ => null
};
}
}