Esempio n. 1
0
        public ActionResult WaterfallFavListData(int UserID, int startIndex)
        {
            if (!LoadUserInfo(UserID))
            {
                return(new EmptyResult());
            }
            int pageSize = FavAllPageSize;

            ViewBag.BasePageSize = FavBasePageSize;
            //重置分页起始索引
            startIndex = startIndex > 1 ? startIndex + 1 : 1;
            //计算分页结束索引
            int endIndex  = startIndex > 1 ? startIndex + _waterfallDetailCount - 1 : _waterfallDetailCount;;
            int toalCount = 0;

            YSWL.MALL.BLL.SNS.UserFavourite UfBll = new YSWL.MALL.BLL.SNS.UserFavourite();
            //获取总条数
            toalCount = UserModel.FavouritesCount.Value;
            if (toalCount < 1)
            {
                return(new EmptyResult());                 //NO DATA
            }
            YSWL.MALL.ViewModel.SNS.PhotoList models = new MALL.ViewModel.SNS.PhotoList();
            //分页获取数据
            models.PhotoListWaterfall = UfBll.GetFavListByPage(
                UserID, "", startIndex, endIndex);
            ViewBag.IsCurrentUser = this.IsCurrentUser;
            return(View(CurrentThemeViewPath + "/UserProfile/FavListWaterfall.cshtml", models));
        }
Esempio n. 2
0
        /// <summary>
        /// 用户喜欢
        /// </summary>
        /// <returns></returns>
        public ActionResult Fav(int?uid, int?pageIndex)
        {
            if (!LoadUserInfo(uid == null ? 0 : uid.Value))
            {
                if (MvcApplication.MainAreaRoute == AreaRoute.SNS)
                {
                    //SNS 主域
                    return(Redirect(ViewBag.BasePath + "Account/Login"));
                }
                return(Redirect("/SNS/Account/Login"));
            }
            int startIndex, endIndex, totalCount;

            pageIndex  = pageIndex.HasValue ? pageIndex.Value : 1;
            startIndex = ViewModel.ViewModelBase.GetStartPageIndex(FavBasePageSize, pageIndex.Value);
            endIndex   = startIndex + FavBasePageSize - 1;
            totalCount = UserModel.FavouritesCount.Value;
            ViewBag.WaterfallStartIndex = endIndex;
            ViewBag.WaterfallEndIndex   = pageIndex.Value * FavAllPageSize > totalCount ? totalCount : pageIndex.Value * FavAllPageSize;
            ViewBag.UserId      = this.UserID;
            ViewBag.RequestPage = this.GetType().Name == "UserController" ? "User" : "Profile";
            if (totalCount < 0)
            {
                return(new EmptyResult());
            }
            YSWL.MALL.BLL.SNS.UserFavourite   UfBll  = new YSWL.MALL.BLL.SNS.UserFavourite();
            YSWL.MALL.ViewModel.SNS.PhotoList models = new MALL.ViewModel.SNS.PhotoList();
            ViewBag.IsCurrentUser = this.IsCurrentUser;
            ViewBag.NickName      = this.NickName;
            models.PhotoPagedList = UfBll.GetFavListByPage(this.UserID, "", startIndex, endIndex).ToPagedList(pageIndex ?? 1, FavBasePageSize);
            if (Request.IsAjaxRequest())
            {
                return(PartialView(CurrentThemeViewPath + "/UserProfile/FavList.cshtml", models));
            }
            #region SEO 优化设置
            IPageSetting pageSetting = PageSetting.GetPageSetting("Base", ApplicationKeyType.SNS);
            ViewBag.Keywords    = pageSetting.Keywords;
            ViewBag.Description = pageSetting.Description;
            if (ViewBag.IsCurrentUser == true)
            {
                ViewBag.Title = "我的喜欢 - " + pageSetting.Title;
            }
            else
            {
                ViewBag.Title = this.NickName + "的喜欢 - " + pageSetting.Title;
            }
            #endregion
            return(View(CurrentThemeViewPath + "/UserProfile/FavIndex.cshtml", models));
        }