Exemple #1
0
        private void SetCache(ApplicationUser user)
        {
            Guid             key           = new Guid(user.Id);
            ProfileViewModel cachedProfile = profileAppService.GetUserProfileWithCache(key);

            if (cachedProfile == null)
            {
                ProfileViewModel profile = profileAppService.GetByUserId(key, ProfileType.Personal);
                if (profile != null)
                {
                    profileAppService.SetProfileCache(key, profile);
                }
            }
        }
        public IActionResult Index()
        {
            OperationResultListVo <RankingViewModel> serviceResult = gamificationAppService.GetAll();

            List <RankingViewModel> objs = serviceResult.Value.ToList();

            foreach (RankingViewModel obj in objs)
            {
                Application.ViewModels.User.ProfileViewModel profile = profileAppService.GetUserProfileWithCache(obj.UserId);

                if (profile != null)
                {
                    obj.Name            = profile.Name;
                    obj.ProfileImageUrl = UrlFormatter.ProfileImage(obj.UserId);
                    obj.CoverImageUrl   = UrlFormatter.ProfileCoverImage(obj.UserId, profile.Id, profile.LastUpdateDate, profile.HasCoverImage);
                }
            }

            return(View(objs));
        }