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; }
public GalleryController(SiteContext context) { _context = context; }
public ProductController(SiteContext context) { _context = context; }
public ContentController(SiteContext context) { _context = context; }
public HomeController(SiteContext context) { _context = context; }