示例#1
0
        public IActionResult getInstagramFeeds(long boardId, int skip, int count)
        {
            DatabaseRepository dbr = new DatabaseRepository(_logger, _env);

            Domain.Socioboard.Models.MongoBoards board = BoardMeRepository.getBoard(boardId, _redisCache, _appSettings, _logger, dbr);

            MongoRepository boardrepo = new MongoRepository("MongoBoardInstagramFeeds", _appSettings);

            try
            {
                var builder = Builders <MongoBoardInstagramFeeds> .Sort;
                var sort    = builder.Descending(t => t.Publishedtime);
                //var result = boardrepo.FindWithRange<MongoBoardInstagramFeeds>(t => t.Instagramaccountid.Equals(board.instagramHashTag),sort,skip, count).ConfigureAwait(false);
                var result = boardrepo.BoardFind <MongoBoardInstagramFeeds>(t => t.Instagramaccountid.Equals(board.instagramHashTag)).ConfigureAwait(false);
                var task   = Task.Run(async() =>
                {
                    return(await result);
                });
                IList <MongoBoardInstagramFeeds> objTwitterPagelist     = task.Result;
                List <MongoBoardInstagramFeeds>  objBoardGplusPagefeeds = objTwitterPagelist.OrderByDescending(t => t.Publishedtime).Skip(Convert.ToInt32(skip)).Take(Convert.ToInt32(count)).ToList();
                return(Ok(objBoardGplusPagefeeds));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.StackTrace);
                return(Ok("Something Went Wrong"));
            }
        }
示例#2
0
        public IActionResult getGplusfeeds(long boardId, string skip, string count)
        {
            DatabaseRepository dbr = new DatabaseRepository(_logger, _env);

            Domain.Socioboard.Models.MongoBoards board = BoardMeRepository.getBoard(boardId, _redisCache, _appSettings, _logger, dbr);
            MongoRepository boardrepo = new MongoRepository("MongoBoardGplusFeeds", _appSettings);

            try
            {
                //List<MongoBoardGplusFeeds> objBoardGplusPagefeeds = boardrepo.getBoardGplusfeedsbyrange(Guid.Parse(BoardGplusprofileId), Convert.ToInt32(_noOfDataToSkip), Convert.ToInt32(_noOfResultsFromTop));
                var builder = Builders <MongoBoardGplusFeeds> .Sort;
                var sort    = builder.Descending(t => t.Publishedtime);
                //var result = boardrepo.FindWithRange<MongoBoardGplusFeeds>(t => t.Gplusboardaccprofileid.Equals(board.gplusHashTag),sort,Convert.ToInt32(skip),Convert.ToInt32(count)).ConfigureAwait(false);
                var result = boardrepo.BoardFind <MongoBoardGplusFeeds>(t => t.Gplusboardaccprofileid.Equals(board.gplusHashTag)).ConfigureAwait(false);
                var task   = Task.Run(async() =>
                {
                    return(await result);
                });
                IList <MongoBoardGplusFeeds> objTwitterPagelist     = task.Result;
                List <MongoBoardGplusFeeds>  objBoardGplusPagefeeds = objTwitterPagelist.OrderByDescending(t => t.Publishedtime).Skip(Convert.ToInt32(skip)).Take(Convert.ToInt32(count)).ToList();
                return(Ok(objBoardGplusPagefeeds));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return(Ok("Something Went Wrong"));
            }
        }
        public IActionResult getfacebookFeeds(long boardId, int skip, int count)
        {
            DatabaseRepository dbr = new DatabaseRepository(_logger, _env);

            Domain.Socioboard.Models.MongoBoards board = BoardMeRepository.getBoard(boardId, _redisCache, _appSettings, _logger, dbr);
            MongoRepository boardrepo = new MongoRepository("MongoBoardFbTrendingFeeds", _appSettings);

            try
            {
                //var result = boardrepo.Find<MongoBoardFbTrendingFeeds>(t => t.facebookprofileid.Equals(board.facebookHashTag));
                //var task = Task.Run(async () =>
                //{
                //    return await result;
                //});
                //IList<MongoBoardFbTrendingFeeds> objTwitterPagelist = task.Result;
                //List<MongoBoardFbTrendingFeeds> objBoardGplusPagefeeds = objTwitterPagelist.OrderByDescending(t => t.publishedtime).Skip(Convert.ToInt32(skip)).Take(Convert.ToInt32(count)).ToList();
                //return Ok(objBoardGplusPagefeeds);
                var builder = Builders <MongoBoardFbTrendingFeeds> .Sort;
                var sort    = builder.Descending(t => t.publishedtime);
                var result  = boardrepo.FindWithRange <MongoBoardFbTrendingFeeds>(t => t.facebookprofileid.Equals(board.facebookHashTag), sort, skip, count);
                var task    = Task.Run(async() =>
                {
                    return(await result);
                });
                IList <MongoBoardFbTrendingFeeds> objTwitterPagelist = task.Result;
                return(Ok(objTwitterPagelist));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return(Ok("Something Went Wrong"));
            }
        }
        public async Task <IActionResult> getGplusfeeds(long boardId, int skip, int count)
        {
            try
            {
                DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
                Domain.Socioboard.Models.MongoBoards board = BoardMeRepository.getBoard(boardId, _redisCache, _appSettings, _logger, dbr);
                MongoRepository        mongorepo           = new MongoRepository("MongoBoardGplusHashTag", _appSettings);
                MongoBoardGplusHashTag gplushashtag        = await mongorepo.FindFirstOrDefault <MongoBoardGplusHashTag>(x => x.Boardid.Equals(board.boardId)).ConfigureAwait(false);

                List <MongoBoardGplusFeeds> GplusFeedsList = GplusRepository.AddBoardGplusTagFeeds(gplushashtag.Displayname, board.gplusHashTag, _appSettings, _logger);
                if (GplusFeedsList.Count == 0)
                {
                    MongoRepository boardrepo = new MongoRepository("MongoBoardGplusFeeds", _appSettings);
                    var             builder   = Builders <MongoBoardGplusFeeds> .Sort;
                    var             sort      = builder.Descending(t => t.Publishedtime);
                    IList <MongoBoardGplusFeeds> objTwitterPagelist = await boardrepo.FindWithRange <MongoBoardGplusFeeds>(t => t.Gplusboardaccprofileid.Equals(board.gplusHashTag) && t.Feedlink != null, sort, skip, count);

                    List <MongoBoardGplusFeeds> lstBGFeeds = objTwitterPagelist.ToList();
                    foreach (var items_lstBGFeed in lstBGFeeds)
                    {
                        if (items_lstBGFeed.FromName.Any(c => char.IsSymbol(c)) || items_lstBGFeed.Title.Contains("¾"))
                        {
                            objTwitterPagelist.Remove(items_lstBGFeed);
                        }
                    }
                    return(Ok(objTwitterPagelist));
                }
                return(Ok(GplusFeedsList));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return(Ok("Something Went Wrong"));
            }
        }
        public async Task <IActionResult> getTwitterFeeds(long boardId, int skip, int count)
        {
            try
            {
                DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
                Domain.Socioboard.Models.MongoBoards board = BoardMeRepository.getBoard(boardId, _redisCache, _appSettings, _logger, dbr);
                MongoRepository          mongorepo         = new MongoRepository("MongoBoardTwitterHashTag", _appSettings);
                MongoBoardTwitterHashTag twitterhashtag    = await mongorepo.FindFirstOrDefault <MongoBoardTwitterHashTag>(x => x.Boardid.Equals(board.boardId)).ConfigureAwait(false);

                List <MongoBoardTwtFeeds> twtFeedsList = TwitterRepository.AddBoardTwitterHashTagFeeds(twitterhashtag.Screenname, board.twitterHashTag, null, _appSettings, _logger);
                if (twtFeedsList.Count == 0)
                {
                    MongoRepository            boardrepo          = new MongoRepository("MongoBoardTwtFeeds", _appSettings);
                    var                        builder            = Builders <MongoBoardTwtFeeds> .Sort;
                    var                        sort               = builder.Descending(t => t.Publishedtime);
                    IList <MongoBoardTwtFeeds> objTwitterPagelist = await boardrepo.FindWithRange <MongoBoardTwtFeeds>(t => t.Twitterprofileid.Equals(board.twitterHashTag) && t.Feedurl != null, sort, skip, count);

                    return(Ok(objTwitterPagelist));
                }
                return(Ok(twtFeedsList));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            return(Ok("Something Went Wrong"));
        }
        public IActionResult getBoardFeedsByName(string boardName)
        {
            boardName = boardName.Replace("SB", "/");
            boardName = boardName.Replace("____", "\\");
            try
            {
                DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
                List <Domain.Socioboard.Models.MongoBoards> lstboard = dbr.Find <Domain.Socioboard.Models.MongoBoards>(t => t.TempboardName == boardName).ToList();
                if (lstboard.Count > 1)
                {
                    foreach (Domain.Socioboard.Models.MongoBoards brd in lstboard)
                    {
                        if (brd.facebookHashTag != null)
                        {
                            return(Ok(BoardMeRepository.getBoardFeedsByName(brd.boardId, _redisCache, _appSettings, _logger, dbr)));
                        }
                    }
                    return(Ok());
                }
                else if (lstboard.Count == 1)
                {
                    return(Ok(BoardMeRepository.getBoardByName(lstboard.First().boardName, _redisCache, _appSettings, _logger, dbr)));
                }
                else
                {
                    return(Ok());
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return(BadRequest("Something Went Wrong"));
            }

            //try
            //{
            //    Domain.Socioboard.Models.MongoBoards board = dbr.Single<Domain.Socioboard.Models.MongoBoards>(t => t.TempboardName == boardName);
            //    if(board!=null)
            //    {
            //        return Ok(BoardMeRepository.getBoardByName(board.boardName, _redisCache, _appSettings, _logger, dbr));
            //    }
            //    else
            //    {
            //        return Ok();
            //    }

            //}
            //catch (Exception ex)
            //{
            //    Console.WriteLine(ex.StackTrace);
            //    return BadRequest("Something Went Wrong");
            //}
        }
示例#7
0
 public IActionResult getBoardByName(string boardName)
 {
     try
     {
         return(Ok(BoardMeRepository.getBoardByName(boardName, _redisCache, _appSettings, _logger)));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         return(BadRequest("Something Went Wrong"));
     }
 }
示例#8
0
 public IActionResult getTopTrending()
 {
     try
     {
         DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
         return(Ok(BoardMeRepository.getTopTrending(_redisCache, _appSettings, _logger, dbr)));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
         return(BadRequest("Something Went Wrong"));
     }
 }
示例#9
0
        public IActionResult getBoardByName(string boardName)
        {
            boardName = boardName.Replace("SB", "/");
            DatabaseRepository dbr = new DatabaseRepository(_logger, _env);

            try
            {
                return(Ok(BoardMeRepository.getBoardByName(boardName, _redisCache, _appSettings, _logger, dbr)));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return(BadRequest("Something Went Wrong"));
            }
        }
示例#10
0
        public IActionResult getTwitterFeeds(string boardId, int skip, int count)
        {
            MongoBoards     board     = BoardMeRepository.getBoard(boardId, _redisCache, _appSettings, _logger);
            MongoRepository boardrepo = new MongoRepository("MongoBoardTwtFeeds", _appSettings);

            try
            {
                var result = boardrepo.Find <MongoBoardTwtFeeds>(t => t.Twitterprofileid.Equals(board.twitterHashTag)).ConfigureAwait(false);
                var task   = Task.Run(async() =>
                {
                    return(await result);
                });
                IList <MongoBoardTwtFeeds> objTwitterPagelist     = task.Result;
                List <MongoBoardTwtFeeds>  objBoardGplusPagefeeds = objTwitterPagelist.OrderByDescending(t => t.Publishedtime).Skip(Convert.ToInt32(skip)).Take(Convert.ToInt32(count)).ToList();
                return(Ok(objBoardGplusPagefeeds));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return(Ok("Something Went Wrong"));
            }
        }