public virtual Vendor ToLiquidVendor(Storefront.Model.Vendor vendor) { var result = new Vendor(); result.Description = vendor.Description; result.GroupName = vendor.GroupName; result.Id = vendor.Id; result.LogoUrl = vendor.LogoUrl; result.Name = vendor.Name; result.SiteUrl = vendor.SiteUrl; result.Handle = vendor.SeoInfo != null ? vendor.SeoInfo.Slug : vendor.Id; var shopifyAddressModels = vendor.Addresses.Select(a => ToLiquidAddress(a)); result.Addresses = new MutablePagedList <Address>(shopifyAddressModels); result.DynamicProperties = vendor.DynamicProperties; if (vendor.Products != null) { result.Products = new MutablePagedList <Product>((pageNumber, pageSize, sortInfos) => { vendor.Products.Slice(pageNumber, pageSize, sortInfos); return(new StaticPagedList <Product>(vendor.Products.Select(x => ToLiquidProduct(x)), vendor.Products)); }, vendor.Products.PageNumber, vendor.Products.PageSize); } return(result); }
public virtual Vendor ToLiquidVendor(Storefront.Model.Vendor vendor) { var result = new Vendor(); result.InjectFrom <NullableAndEnumValueInjecter>(vendor); result.Handle = vendor.SeoInfo != null ? vendor.SeoInfo.Slug : vendor.Id; var shopifyAddressModels = vendor.Addresses.Select(a => ToLiquidAddress(a)); result.Addresses = new MutablePagedList <Address>(shopifyAddressModels); result.DynamicProperties = vendor.DynamicProperties; if (vendor.Products != null) { result.Products = new MutablePagedList <Product>((pageNumber, pageSize, sortInfos) => { vendor.Products.Slice(pageNumber, pageSize, sortInfos); return(new StaticPagedList <Product>(vendor.Products.Select(x => ToLiquidProduct(x)), vendor.Products)); }, vendor.Products.PageNumber, vendor.Products.PageSize); } return(result); }