コード例 #1
0
        /// <summary>
        /// 用户状态菜单控件
        /// </summary>
        /// <param name="spaceKey">空间标识</param>
        public ActionResult _UserStatus(string spaceKey)
        {
            User         user         = userService.GetUser(spaceKey) as User;
            CountService countService = new CountService(TenantTypeIds.Instance().User());
            int          countPerDay  = countService.GetStageCount(CountTypes.Instance().HitTimes(), 7, user.UserId);
            int          countAll     = countService.Get(CountTypes.Instance().HitTimes(), user.UserId);

            ViewData["accessedCount"] = countPerDay + "/" + countAll;

            VisitService        visitService = new VisitService(TenantTypeIds.Instance().User());
            IEnumerable <Visit> visits       = visitService.GetTopMyVisits(user.UserId, 1);

            if (visits != null && visits.FirstOrDefault() != null)
            {
                ViewData["lastVisitDate"] = visits.FirstOrDefault().LastVisitTime.ToFriendlyDate();
            }

            return(View(user));
        }