public static List <Models.FeatureProduct> RemoveReferences(this List <Models.FeatureProduct> list) { var newList = new List <Models.FeatureProduct>(); list.ForEach(item => { var obj = new Models.FeatureProduct(); obj = item.RemoveReferences(); newList.Add(obj); }); return(newList); }
private static Models.FeatureProduct RemoveReference(this Models.FeatureProduct item) { var obj = new Models.FeatureProduct(); if (item != null) { obj.Id = item.Id; obj.ProductId = item.ProductId; obj.IsActive = item.IsActive; } return(obj); }
public static Models.FeatureProduct RemoveReferences(this Models.FeatureProduct item) { var obj = new Models.FeatureProduct(); obj = item.RemoveReference(); if (item.Product != null) { if (item.Product.IsActive == true) { obj.Product = new Models.Product(); obj.Product = item.Product.RemoveReference(); if (item.Product.ProductImages != null) { obj.Product.ProductImages = new List <ProductImage>(); var templist = item.Product.ProductImages.Where(x => x.IsActive == true).ToList(); foreach (var img in templist) { obj.Product.ProductImages.Add(img.RemoveReference()); } } } } return(obj); }