Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

502 B
Raw Blame
namespace Grand.Web.Common.Themes;

public class ThemeContextFactory : IThemeContextFactory
{
    private readonly IDictionary<string, IThemeContext> _themeContexts;

    public ThemeContextFactory(IEnumerable<IThemeContext> themeContexts)
    {
        _themeContexts = themeContexts.ToDictionary(f => f.AreaName, f => f);
    }

    public IThemeContext GetThemeContext(string areaName)
    {
        return _themeContexts.TryGetValue(areaName, out var themeContext) ? themeContext : null;
    }
}