public IActionResult Index(string type)
        {
            ViewBag.type = type;

            CollectionIndexViewModel CollectionIndexViewModel = new CollectionIndexViewModel
            {
            };

            return(View(CollectionIndexViewModel));
        }
示例#2
0
        public async Task <IActionResult> Index()
        {
            var collections = await _productService.GetAllProductCollectionsAsync();

            if (collections == null || collections.Count == 0)
            {
                return(BadRequest());
            }

            var reorderedCollections = ReorderCollectionsForProductsPage(collections);

            var vM = new CollectionIndexViewModel
            {
                Collections = reorderedCollections
            };

            return(View(vM));
        }
示例#3
0
        public IActionResult Index()
        {
            var newArticlesModel   = this.homeService.NewArticles();
            var topRegularArticles = this.homeService.TopRegularArticles();
            var topScienceArticles = this.homeService.TopScienceArticles();
            var topKidsArticles    = this.homeService.TopKidsArticles();
            var newVideosModel     = this.homeService.TopVideos();
            var topEducationsModel = this.homeService.TopEducations();
            var topEventsModel     = this.homeService.TopEvents();
            var topPollModel       = this.homeService.TopPoll();

            var newArticles = newArticlesModel.Select(x => new IndexViewModel
            {
                Id         = x.Id,
                Title      = x.Title,
                Content    = x.Content,
                TitleImage = x.ArticleImage,
            }).ToList();

            var regularTopArticles = topRegularArticles.Select(x => new IndexViewModel
            {
                Id         = x.Id,
                Title      = x.Title,
                Content    = x.Content,
                TitleImage = x.ArticleImage,
            }).ToList();

            var scienceTopArticles = topScienceArticles.Select(x => new IndexViewModel
            {
                Id         = x.Id,
                Title      = x.Title,
                Content    = x.Content,
                TitleImage = x.ArticleImage,
            }).ToList();

            var kidsTopArticles = topKidsArticles.Select(x => new IndexViewModel
            {
                Id         = x.Id,
                Title      = x.Title,
                Content    = x.Content,
                TitleImage = x.ArticleImage,
            }).ToList();

            var topEducations = topEducationsModel.Select(x => new IndexViewModel
            {
                Id         = x.Id,
                Title      = x.Title,
                Content    = x.Content,
                TitleImage = x.ImageUrl,
            }).ToList();

            var newVideos = newVideosModel.Select(x => new IndexVideoViewModel
            {
                Id          = x.Id,
                Title       = x.Title,
                Content     = x.Description,
                YoutubeLink = x.YoutubeLink,
            }).ToList();

            var newEvents = topEventsModel.Select(x => new IndexViewModel
            {
                Id      = x.Id,
                Title   = x.Name,
                Content = x.Description,
            }).ToList();

            var newPoll = new IndexPollViewModel
            {
                Id      = topPollModel.Id,
                Title   = topPollModel.Title,
                Answers = this.pollService.GetPollsAnswers(topPollModel.Id),
                Users   = this.pollService.GetPollsParticipants(topPollModel.Id),
            };

            var model = new CollectionIndexViewModel
            {
                NewArticles        = newArticles,
                TopRegularArticles = regularTopArticles,
                TopKidsArticles    = kidsTopArticles,
                TopScienceArticles = scienceTopArticles,
                NewVideos          = newVideos,
                NewEducations      = topEducations,
                NewEvents          = newEvents,
                NewPoll            = newPoll,
            };

            return(this.View(model));
        }