using NetinaShop.Domain.Entities.Accounting; namespace NetinaShop.Domain; public class MapsterRegister : IRegister { public void Register(TypeAdapterConfig config) { config.NewConfig() .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() .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() .Map("ShippingMethod", o => o.Shipping != null ? o.Shipping.Name : string.Empty) .TwoWays(); config.NewConfig() .Map("ParentName", o => o.Parent != null ? o.Parent.Name : string.Empty) .TwoWays(); config.NewConfig() .Map("MainImage",o=>o.Files.FirstOrDefault(f=>f.IsPrimary) != null ? o.Files.FirstOrDefault(f => f.IsPrimary).FileLocation : o.Files.Count>0 ? o.Files.FirstOrDefault().FileLocation : string.Empty) .Map("CategoryName", o => o.Category == null ? null : o.Category.Name) .Map("BrandName", o => o.Brand == null ? null : o.Brand.Name) .IgnoreNullValues(false) .TwoWays(); config.NewConfig() .Map("UserFullName", o => o.User != null ? o.User.FirstName + " " + o.User.LastName : string.Empty) .Map("UserPhoneNumber", o => o.User != null ? o.User.PhoneNumber : string.Empty) .IgnoreNullValues(false) .TwoWays(); config.NewConfig() .Map("UserFullName", o => o.User != null ? o.User.FirstName + " " + o.User.LastName : string.Empty) .Map("UserPhoneNumber", o => o.User != null ? o.User.PhoneNumber : string.Empty) .IgnoreNullValues(false) .TwoWays(); config.NewConfig() .Map("ProductName", o => o.Product != null ? o.Product.PersianName : string.Empty) .IgnoreNullValues(false) .TwoWays(); config.NewConfig() .Map("UserFullName", o => o.User != null ? o.User.FirstName + " " + o.User.LastName : string.Empty) .Map("UserPhoneNumber", o => o.User != null ? o.User.PhoneNumber : string.Empty) .IgnoreNullValues(false) .TwoWays(); config.NewConfig() .Map("CategoryName", o => o.Category == null ? null : o.Category.Name) .Map("BrandName", o => o.Brand == null ? null : o.Brand.Name) .IgnoreNullValues(false) .TwoWays(); } }