Beispiel #1
0
        public SiteModel(SiteContext context, string contentId)
        {
            Title = "ПЕНЕТРОН УКРАИНА";
            Content = context.Content.Include("ContentItems").FirstOrDefault(c => c.Name == contentId) ?? context.Content.First(c => c.MainPage);
            SeoDescription = Content.SeoDescription;
            SeoKeywords = Content.SeoKeywords;
            Reasons = context.Reason.ToList();
            Sliders = context.Slider.ToList();

        }
Beispiel #2
0
 public BuildingController(SiteContext context)
 {
     _context = context;
 }
Beispiel #3
0
 public HomeController(SiteContext context)
 {
     _context = context;
 }
Beispiel #4
0
        public BuildingModel(SiteContext context, string categoryId, string subCategoryId, int contentType, string articleId=null)
            : base(context, null)
        {
            _categoryId = categoryId;
            _subCategoryId = subCategoryId;
            _contentId = subCategoryId ?? categoryId;

            _buildings = context.Building.Include("Children").Include("BuildingItems").Where(b => b.ContentType == contentType).ToList();

            if (categoryId != null)
                if (subCategoryId == null)
                    ParentTitle = _buildings.Single(t => t.CategoryLevel == 0).Title;

            Building = _buildings.FirstOrDefault(t => t.Name == _contentId) ?? _buildings.First(t => t.CategoryLevel == 0);




            if (!HttpContext.Current.Request.IsAuthenticated)
            {
                if (Building.CategoryLevel == 0 && !Building.Active)
                {
                    Building = _buildings.Where(t => t.Parent == null && t.CategoryLevel != 0).Where(t => t.SortOrder == _buildings.Min(c => (int?)c.SortOrder)).FirstOrDefault();
                    //Building = _buildings.FirstOrDefault(t => t.Parent == null && t.CategoryLevel != 0);
                    if (Building != null)
                    {
                        ActiveCategoryNotFound = true;
                        RedirectCategoryId = Building.Name;
                        return;
                    }
                }
                if (Building != null)
                {
                    if (Building.CategoryLevel != 0 && !Building.Active && Building.Children.Any())
                    {
                        ActiveCategoryNotFound = true;
                        RedirectCategoryId = Building.Name;
                        RedirectSubCategoryId = Building.Children.First().Name;
                        return;
                    }
                }
            }

            if (Building != null)
            {
                if (Building.Parent != null)
                {
                    ParentTitle = Building.Parent.Title;
                }
                SeoDescription = Building.SeoDescription;
                SeoKeywords = Building.SeoKeywords;
            }
            GetMenu();
            if (contentType == 1)
            {
                BuildingObjects = context.BuildingObj.ToList();
            }


            if (articleId != null)
                Article = context.Article.First(a => a.Name == articleId);
        }
 public TechnologyController(SiteContext context)
 {
     _context = context;
 }
Beispiel #6
0
 public ContentController(SiteContext context)
 {
     _context = context;
 }
Beispiel #7
0
 public ArticleController(SiteContext context)
 {
     _context = context;
 }
Beispiel #8
0
 public SliderController(SiteContext context)
 {
     _context = context;
 }
Beispiel #9
0
 public ReasonController(SiteContext context)
 {
     _context = context;
 }