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.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
using Grand.Mapping;
using Grand.Domain.Directory;
using Grand.Infrastructure.Mapper;
using Grand.Web.AdminShared.Models.Directory;
using Grand.Web.Common.Extensions;
namespace Grand.Web.AdminShared.Mapper;
public class CountryProfile : Profile, IAutoMapperProfile
{
public CountryProfile()
{
//countries
CreateMap<Country, CountryModel>()
.ForMember(dest => dest.Locales, mo => mo.Ignore())
.ForMember(dest => dest.NumberOfStates,
mo => mo.MapFrom(src => src.StateProvinces != null ? src.StateProvinces.Count : 0))
.ForMember(dest => dest.Locales, mo => mo.Ignore());
CreateMap<CountryModel, Country>()
.ForMember(dest => dest.Id, mo => mo.Ignore())
.ForMember(dest => dest.Locales, mo => mo.MapFrom(x => x.Locales.ToTranslationProperty()))
.ForMember(dest => dest.StateProvinces, mo => mo.Ignore())
.ForMember(dest => dest.LimitedToStores, mo => mo.MapFrom(x => x.Stores != null && x.Stores.Any()));
}
public int Order => 0;
}