public PopularTagsResponse GetPopularTags(PopularTagsRequest request) { Logger.Current.Verbose("Request received to fetch popular tags for accountid: " + request.AccountId); PopularTagsResponse response = new PopularTagsResponse(); IEnumerable <Tag> popularTags = tagRepository.GetPopularTags(request.Limit, request.AccountId); response.TagsViewModel = convertToViewModel(popularTags, request.TagsList); Logger.Current.Informational("Popular tags count: " + response.TagsViewModel.Count()); return(response); }
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)); }