Beispiel #1
0
        public async Task <IActionResult> SearchResultsGlobal(List <string> source, List <string> scout, List <string> alignment, List <string> theme, List <string> technologyArea, List <string> landscape,
                                                              List <string> country, List <string> state, List <string> city, List <string> stage, string dateAdded1st, string dateAdded2nd, string dateReviewed1st, string dateReviewed2nd, string globalSearch)
        {
            SearchResultsVM searchResultsVM = new SearchResultsVM();

            searchResultsVM.UsersList    = GetListOfUsers(globalSearch);
            searchResultsVM.SearchString = globalSearch;

            //----------------------------------------------------------------------
            string      uid         = User.FindFirstValue(ClaimTypes.NameIdentifier);
            AspNetUsers thisAspUser = _context.AspNetUsers.Where(x => x.Id == uid).First();
            Users       thisUser    = _context.Users.Where(x => x.UserId == uid).First();

            ViewBag.AspUser = thisAspUser;
            ViewBag.User    = thisUser;

            Startups startups = await _seamedInDal.GetStartups();

            var rankedStartups = Ranking(startups, thisUser).ToList();

            ViewBag.Startups = rankedStartups;

            if (globalSearch != null)
            {
                Startups foundStartups = await _seamedInDal.GetFilteredStartUps(globalSearch.ToLower());

                List <Tuple <int, Record> > rankedStartupsFromGlobal = RankingVersion2(foundStartups, thisUser);

                searchResultsVM.ResultsList = rankedStartupsFromGlobal;

                return(View(searchResultsVM));
            }
            else
            {
                List <List <string> > listOfLists = new List <List <string> >();

                listOfLists.Add(source);
                listOfLists.Add(scout);
                listOfLists.Add(alignment);
                listOfLists.Add(theme);
                listOfLists.Add(technologyArea);
                listOfLists.Add(landscape);
                listOfLists.Add(country);
                listOfLists.Add(state);
                listOfLists.Add(city);
                listOfLists.Add(stage);

                List <string> convertedList = _seamedInDal.ConvertsListsOfFormSelection(listOfLists);
                Startups      foundStartups = await _seamedInDal.GetFilteredStartUps(convertedList);

                List <Tuple <int, Record> > rankedStartupsFromFilter = RankingVersion2(foundStartups, thisUser);

                searchResultsVM.ResultsList = rankedStartupsFromFilter;

                return(View(searchResultsVM));
            }
        }
        public async Task <IActionResult> SearchPage()
        {
            string uid = User.FindFirstValue(ClaimTypes.NameIdentifier);

            AspNetUsers thisAspUser = _context.AspNetUsers.Where(x => x.Id == uid).First();

            Users thisUser = _context.Users.Where(x => x.UserId == uid).First();

            ViewBag.AspUser = thisAspUser;

            ViewBag.User = thisUser;

            Startups startups = await _seamedInDal.GetStartups();

            var rankedStartups = Ranking(startups, thisUser).ToList();

            ViewBag.Startups = rankedStartups;
            SearchPageVM searchPageVM = await GetStartUpColumnCategoryValues();

            return(View(searchPageVM));
        }
        public async Task <IActionResult> IndexAsync()
        {
            string uid = User.FindFirstValue(ClaimTypes.NameIdentifier);

            AspNetUsers thisAspUser = _context.AspNetUsers.Where(x => x.Id == uid).First();

            Users thisUser = _context.Users.Where(x => x.UserId == uid).First();

            ViewBag.AspUser = thisAspUser;

            ViewBag.User = thisUser;

            Startups startups = await _seamedInDal.GetStartups();

            var rankedStartups = Ranking(startups, thisUser).ToList();

            ViewBag.Startups = rankedStartups;

            var users = _context.AspNetUsers.ToList();

            return(View(users));
        }