示例#1
0
        public string Search(string query)
        {
            DBWorker           dbworker = new DBWorker();
            List <GeneralPost> posts    = dbworker.GetAllPostsByHashTag(query);

            if (posts.Count != 0)
            {
                Pagination   pag = dbworker.GetPaginations(query);
                SearchResult res = new SearchResult();
                res.Posts             = posts;
                res.InstPagination    = pag.InstagrammPagination;
                res.VKPagination      = pag.VKPagination;
                res.TwitterPagination = pag.TwitterPagination;
                res.Query             = query;
                return(JsonConvert.SerializeObject(res));
            }

            AggregatorModel aggregator = new AggregatorModel();

            return(JsonConvert.SerializeObject(aggregator.Search(query)));
        }