예제 #1
0
        public RecentTagsResponse GetRecentTags(RecentTagsRequest request)
        {
            Logger.Current.Verbose("Request received to fetch recent tags for accountid: " + request.AccountId);
            RecentTagsResponse response   = new RecentTagsResponse();
            IEnumerable <Tag>  recentTags = tagRepository.GetRecentTags(request.Limit, request.AccountId);

            response.TagsViewModel = convertToViewModel(recentTags, request.TagsList);
            Logger.Current.Informational("Recent tags count: " + response.TagsViewModel.Count());
            return(response);
        }
예제 #2
0
        public ActionResult GetRecentPopularTags(string tagList)
        {
            int[] myInts = new int[] { };
            if (!String.IsNullOrEmpty(tagList))
            {
                string[] array = tagList.Split(',');
                myInts = array.Select(int.Parse).ToArray();
            }

            GetTagListResponse  response            = new GetTagListResponse();
            PopularTagsResponse popularTagsResponse = tagService.GetPopularTags(new PopularTagsRequest()
            {
                AccountId = this.Identity.ToAccountID(), TagsList = myInts, Limit = 10
            });

            if (popularTagsResponse.TagsViewModel != null)
            {
                response.PopularTags = popularTagsResponse.TagsViewModel;
            }
            else
            {
                response.PopularTags = null;
            }

            RecentTagsResponse recentTagsResponse = tagService.GetRecentTags(new RecentTagsRequest()
            {
                AccountId = this.Identity.ToAccountID(), TagsList = myInts, Limit = 10
            });

            if (recentTagsResponse.TagsViewModel != null)
            {
                response.RecentTags = recentTagsResponse.TagsViewModel;
            }

            return(Json(new { success = true, response }, JsonRequestBehavior.AllowGet));
        }