public ProductOutputModel(product p)
        {
            Id = p.id;
            Title = new LangOutputModel(p.text_title);
            //SEO
            Subtitle = new LangOutputModel(p.text_subtitle);
            Shortdesc = new LangOutputModel(p.text_description);
            Content = new LangOutputModel(p.text_text);

            ConnectedProducts = new List<ProductOutputModel>();

            foreach (product conn in p.products_connections.Select(x => (x.product == p) ? x.product1 : x.product))
            {
                ConnectedProducts.Add(new ProductOutputModel(conn));
            }

            Categories = p.products_categories.Select(x => new CategoryOutputModel(x.category)).ToList<CategoryOutputModel>();
            if (p.image != null)
            {
                mainImage = new ImageOutputModel(p.image);
            }

            documents = new List<DocumentGroupOutputModel>();

            foreach (docgroup dg in p.docgroups_products.Select(x => x.docgroup))
            {
                documents.Add(new DocumentGroupOutputModel(dg));
            }
        }
Exemple #2
0
        private PageListOutputModel getPOM(page p)
        {
            PageListOutputModel pom = new PageListOutputModel();
            pom.Id = p.id;

            LangOutputModel title = new LangOutputModel();
            LangOutputModel content = new LangOutputModel();

            foreach (string lang in Helpers.LangHelper.langs)
            {
                title.setByCulture(lang, p.text.texts_values.Single(x => x.culture == lang).value);
                content.setByCulture(lang, p.text1.texts_values.Single(x => x.culture == lang).value);
            }

            pom.Title = title;
            pom.Content = content;

            return pom;
        }