Пример #1
0
        public GetRecentAndPopularTagsResponse GetRecentAndPopularTags(GetRecentAndPopularTagsRequest request)
        {
            Logger.Current.Verbose("Request receive to fetch Recent and Popular tags for account: " + request.AccountId);
            GetRecentAndPopularTagsResponse response = new GetRecentAndPopularTagsResponse();
            var sw1 = new Stopwatch();

            sw1.Start();
            IEnumerable <RecentPopularTag> recentPopularTags = tagRepository.GetRecentAndPopularTags(request.AccountId);

            sw1.Stop();
            Logger.Current.Informational("Response received in : " + sw1.ElapsedMilliseconds + " ms.");
            response.RecentTags  = convertToViewModel(recentPopularTags.Where(c => c.TagType == "Recent").ToList(), request.TagsList);
            response.PopularTags = convertToViewModel(recentPopularTags.Where(c => c.TagType == "Popular").ToList(), request.TagsList);
            return(response);
        }
Пример #2
0
        public HttpResponseMessage GetRecentPopularTags(string tagList)
        {
            var tagIds = new int[] { };

            if (!String.IsNullOrEmpty(tagList))
            {
                tagIds = Array.ConvertAll(tagList.Split(','), s => int.Parse(s));
            }
            GetRecentAndPopularTagsResponse response = tagService.GetRecentAndPopularTags(new GetRecentAndPopularTagsRequest()
            {
                AccountId = this.AccountId, TagsList = tagIds
            });

            return(Request.BuildResponse(response));
        }