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

namespace Grand.Web.AdminShared.Extensions.Mapping;

public static class CountryMappingExtensions
{
    public static CountryModel ToModel(this Country entity)
    {
        return entity.MapTo<Country, CountryModel>();
    }

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

    public static Country ToEntity(this CountryModel model, Country destination)
    {
        return model.MapTo(destination);
    }

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

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

    public static StateProvince ToEntity(this StateProvinceModel model, StateProvince destination)
    {
        return model.MapTo(destination);
    }
}