public void ConvertFromProduct(Product product) { if (product == null) { return; } this.ProductID = product.id; this.CategoryID = product.idCategory.GetValueOrDefault(0); if (this.CategoryID > 0) { this.CategoryName = product.Category.name; this.SiteID = product.Category.idSite.GetValueOrDefault(0); if (this.SiteID > 0) { this.SiteName = product.Category.Site.name; this.Link = GeneralHelper.ComputeProductLink(product.link, product.Category.Site.link); } } this.Name = product.name; this.Title = product.title; this.Price = product.price.GetValueOrDefault(0); this.InsertDate = product.insertDate.GetValueOrDefault(DateTime.Now); this.UpdateDate = product.updateDate.GetValueOrDefault(DateTime.Now); this.Active = product.active.GetValueOrDefault(false); this.PhotoLink = GeneralHelper.ComputeProductLink(product.photoLink, product.Category.Site.link); this.WebsiteId = product.siteId; }