Ejemplo n.º 1
0
        public static List <Startup> GetStartups()
        {
            var startupFeeds = FeedStream.GetStartupFeed();
            var startups     = GetStartups(startupFeeds.Select(s => s.target.id));

            return(startups);
        }
Ejemplo n.º 2
0
        public static void GetInvestmentsFromFeed()
        {
            try
            {
                DateTime    lastUpdate  = ExecutionUpdater.GetLastUpdateInvestment();
                var         feeds       = FeedStream.GetStartupFeed();
                List <Feed> investments = feeds.Where(f => f.item.typeValue == Entities.FeedTypes.StartupRole &&
                                                      f.timestamp.ToDateTime() > lastUpdate &&
                                                      !string.IsNullOrEmpty(f.description) &&
                                                      f.description.Contains(Constants.INVEST_IN)).ToList();

                //var group = investments.GroupBy(f => f.actor).ToDictionary(k => k.Key.name, v => v.ToList());
                var group = investments.GroupBy(f => f.actor.id);

                Dictionary <Entity, List <Investment> > investmentsFeedGrouped = new Dictionary <Entity, List <Investment> >();
                foreach (var item in group)
                {
                    investmentsFeedGrouped.Add(new Entity()
                    {
                        Id      = item.First().actor.id,
                        Name    = item.First().actor.name,
                        TagLine = item.First().actor.tagline,
                        Url     = item.First().actor.angellist_url
                    }
                                               , (item.Select(investment => new Investment()
                    {
                        Id = investment.id,
                        FundId = investment.actor.id,
                        Startup = new Entity()
                        {
                            Id = investment.target.id,
                            Name = investment.target.name,
                            Url = investment.target.angellist_url,
                            TagLine = investment.target.tagline,
                        },
                        Description = investment.description,
                        DateActivityFeed = investment.timestamp
                    })).ToList());
                }

                SaveDailyActivity(investmentsFeedGrouped);

                //	ExecutionUpdater.InsertFirst();
                ExecutionUpdater.UpdateInvestment();

                //	return investmentsFeedGrouped;
            }
            catch (Exception ex)
            {
                Log.Error("GetInvestmentsFromFeed", "error", ex);
            }
        }