2023-12-31 19:55:22 +03:30
|
|
|
|
namespace NetinaShop.Domain;
|
2023-12-20 10:37:44 +03:30
|
|
|
|
|
|
|
|
|
|
public class MapsterRegister : IRegister
|
|
|
|
|
|
{
|
|
|
|
|
|
public void Register(TypeAdapterConfig config)
|
|
|
|
|
|
{
|
|
|
|
|
|
config.NewConfig<Blog, BlogSDto>()
|
|
|
|
|
|
.Map("HeaderFileName", o => o.Files.Count > 0 && o.Files.Any(f=>f.IsHeader) ? o.Files.FirstOrDefault(f=>f.IsHeader)!.FileName : string.Empty)
|
|
|
|
|
|
.TwoWays();
|
|
|
|
|
|
|
|
|
|
|
|
config.NewConfig<Brand, BrandSDto>()
|
|
|
|
|
|
.Map("HeaderFileName", o => o.Files.Count > 0 && o.Files.Any(f => f.IsHeader) ? o.Files.FirstOrDefault(f => f.IsHeader)!.FileName : string.Empty)
|
|
|
|
|
|
.TwoWays();
|
2024-01-28 10:11:48 +03:30
|
|
|
|
|
2024-02-07 01:12:05 +03:30
|
|
|
|
config.NewConfig<ProductCategory, ProductCategorySDto>()
|
2024-01-28 10:11:48 +03:30
|
|
|
|
.Map("ParentName", o => o.Parent != null ? o.Parent.Name : string.Empty)
|
|
|
|
|
|
.TwoWays();
|
2024-02-07 01:12:05 +03:30
|
|
|
|
|
|
|
|
|
|
config.NewConfig<Product, ProductSDto>()
|
|
|
|
|
|
.Map("CategoryName", o => o.Category != null ? o.Category.Name : string.Empty)
|
|
|
|
|
|
.Map("BrandName", o => o.Brand != null ? o.Brand.Name : string.Empty)
|
|
|
|
|
|
.IgnoreNullValues(false)
|
|
|
|
|
|
.TwoWays();
|
|
|
|
|
|
|
2023-12-20 10:37:44 +03:30
|
|
|
|
}
|
|
|
|
|
|
}
|