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.0 KB
Raw Blame
using Grand.Domain.Documents;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Documents;

namespace Grand.Web.AdminShared.Extensions.Mapping;

public static class DocumentMappingExtensions
{
    public static DocumentModel ToModel(this Document entity)
    {
        return entity.MapTo<Document, DocumentModel>();
    }

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

    public static Document ToEntity(this DocumentModel model, Document destination)
    {
        return model.MapTo(destination);
    }

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

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

    public static DocumentType ToEntity(this DocumentTypeModel model, DocumentType destination)
    {
        return model.MapTo(destination);
    }
}