Example #1
0
        public async Task <IActionResult> Index()
        {
            Home_Index data      = new Home_Index();
            PostIndex  postIndex = new PostIndex();

            int count_canban     = 0;
            int count_canmua     = 0;
            int count_canthue    = 0;
            int count_canchothue = 0;

            data.lst3HotPosts     = postIndex.get3HotPosts();
            data.lst6PopularPosts = postIndex.get6PopularPosts();

            count_canban     = postIndex.getCount(1);
            count_canmua     = postIndex.getCount(3);
            count_canthue    = postIndex.getCount(4);
            count_canchothue = postIndex.getCount(2);

            ViewBag.canban     = count_canban;
            ViewBag.canmua     = count_canmua;
            ViewBag.canthue    = count_canthue;
            ViewBag.canchothue = count_canchothue;
            var user = await _userManager.GetUserAsync(User);

            if (user != null)
            {
                ViewBag.favoritepost = DataProvider.Ins.db.Post_Favorite.Include(p => p.ID_PostNavigation).ThenInclude(p => p.Post_Image).Include(p => p.ID_PostNavigation).ThenInclude(p => p.PostTypeNavigation).Include(p => p.ID_PostNavigation).ThenInclude(p => p.RealEstateTypeNavigation).Include(p => p.ID_UserNavigation)
                                       .Where(p => p.ID_User == user.Id).OrderByDescending(p => p.MortifiedDate).Take(5).ToList();
            }
            return(View(data));
        }
Example #2
0
        public IActionResult Index()
        {
            Home_Index data = new Home_Index();

            PostModel postModel = new PostModel();

            data.lst4NewestPosts  = postModel.get4NewestPosts();
            data.lst6PopularPosts = postModel.get6PopularPosts();

            return(View(data));
        }