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.Messages;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Messages;

namespace Grand.Web.AdminShared.Extensions.Mapping;

public static class ContactAttributeMappingExtensions
{
    //attributes
    public static ContactAttributeModel ToModel(this ContactAttribute entity)
    {
        return entity.MapTo<ContactAttribute, ContactAttributeModel>();
    }

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

    public static ContactAttribute ToEntity(this ContactAttributeModel model, ContactAttribute destination)
    {
        return model.MapTo(destination);
    }

    //contact attribute value
    public static ContactAttributeValueModel ToModel(this ContactAttributeValue entity)
    {
        return entity.MapTo<ContactAttributeValue, ContactAttributeValueModel>();
    }

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

    public static ContactAttributeValue ToEntity(this ContactAttributeValueModel model,
        ContactAttributeValue destination)
    {
        return model.MapTo(destination);
    }
}