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.

1.3 KB
Raw Blame
using Grand.Domain.Knowledgebase;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Knowledgebase;

namespace Grand.Web.AdminShared.Extensions.Mapping;

public static class KnowledgebaseCategoryMappingExtensions
{
    public static KnowledgebaseCategory ToEntity(this KnowledgebaseCategoryModel model)
    {
        return model.MapTo<KnowledgebaseCategoryModel, KnowledgebaseCategory>();
    }

    public static KnowledgebaseCategoryModel ToModel(this KnowledgebaseCategory entity)
    {
        return entity.MapTo<KnowledgebaseCategory, KnowledgebaseCategoryModel>();
    }

    public static KnowledgebaseCategory ToEntity(this KnowledgebaseCategoryModel model,
        KnowledgebaseCategory destination)
    {
        return model.MapTo(destination);
    }

    public static KnowledgebaseArticle ToEntity(this KnowledgebaseArticleModel model)
    {
        return model.MapTo<KnowledgebaseArticleModel, KnowledgebaseArticle>();
    }

    public static KnowledgebaseArticleModel ToModel(this KnowledgebaseArticle entity)
    {
        return entity.MapTo<KnowledgebaseArticle, KnowledgebaseArticleModel>();
    }

    public static KnowledgebaseArticle ToEntity(this KnowledgebaseArticleModel model, KnowledgebaseArticle destination)
    {
        return model.MapTo(destination);
    }
}