Esempio n. 1
0
        public SiteModel(SiteContext context, string contentId, int? productId = null)
        {
            Contents = context.Content;
            Title = "Майкаджексон";
            var minSortorder = Contents.Min(c => c.SortOrder);
            foreach (var content in Contents.Where(content => content.SortOrder == minSortorder))
            {
                content.IsHomepage = true;
                break;
            }

            // в случае заходи на страницу продукта
            if (contentId == null)
            {
                Product = context.Product.First(p => p.Id == productId);
                Content = Product.Content;
            }
            else if (contentId == "")
            {
                //Content = Contents.First(c => c.IsHomepage==true);
                Content = Contents.First(content => content.SortOrder == minSortorder);
            }
            else
            {
                Content = Contents.FirstOrDefault(c => c.Name == contentId);
            }



            Menu = new List<Helpers.MenuItem>();

            foreach (var c in Contents)
            {
                Menu.Add(new Helpers.MenuItem
                {
                    ContentId = c.Id,
                    ContentName = c.Name,
                    Current = c.Name == contentId || contentId == "" && c.IsHomepage,
                    Selected = c.Name == Content.Name,
                    SortOrder = c.SortOrder,
                    Title = c.MenuTitle,
                    ContentType = (ContentType)c.ContentType
                });
            }

            SeoDescription = Content.SeoDescription;
            SeoKeywords = Content.SeoKeywords;
        }
Esempio n. 2
0
 public GalleryController(SiteContext context)
 {
     _context = context;
 }
Esempio n. 3
0
 public ProductController(SiteContext context)
 {
     _context = context;
 }
Esempio n. 4
0
 public ContentController(SiteContext context)
 {
     _context = context;
 }
Esempio n. 5
0
 public HomeController(SiteContext context)
 {
     _context = context;
 }