예제 #1
0
 public AccountController(SLPADDBContext context, UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager)
 {
     this.userManager   = userManager;
     _context           = context;
     this.signInManager = signInManager;
 }
예제 #2
0
 public LaunchpadController(SLPADDBContext context)
 {
     _context = context;
 }
예제 #3
0
        public static List <KeyValuePair <string, double> > FindSimilar(string desc, List <string> themes, List <string> techAreas, StartupListRootObject startupList, SLPADDBContext context)
        {
            List <string>               keywords        = GetKeywords(desc);
            List <StartupContainer>     containers      = startupList.Records;
            List <Models.Startup>       dbStartups      = context.Startup.ToList();
            Dictionary <string, double> scoreDictionary = new Dictionary <string, double>();

            foreach (StartupContainer sc in containers)
            {
                if (desc == sc.Fields.CompanySummary)
                {
                    continue;
                }
                ApiStartup startup = sc.Fields;
                double     score   = GetScore(keywords, techAreas, themes, GetKeywords(startup.CompanySummary), startup.TechAreas, startup.Theme);
                scoreDictionary.Add(startup.CompanyName, score);
            }
            foreach (Models.Startup s in dbStartups)
            {
                try
                {
                    double score = GetScore(keywords, techAreas, themes, GetKeywords(s.Summary), s.TechArea, s.Theme);
                    scoreDictionary.Add(s.Name, score);
                }
                catch
                {
                }
            }
            List <KeyValuePair <string, double> > topScores   = new List <KeyValuePair <string, double> >();
            List <KeyValuePair <string, double> > returnValue = new List <KeyValuePair <string, double> >();

            topScores = scoreDictionary.ToList().OrderByDescending(x => x.Value).ToList();
            for (int i = 0; i < Math.Min(3, topScores.Count); i++)
            {
                returnValue.Add(topScores[i]);
            }
            return(returnValue);
        }