示例#1
0
        public async Task <ViewResult> SearchProjects(SearchProjectsViewModel searchProjectsViewModel)
        {
            //_logger.LogCritical(1002, "Getting item {ID}", id);
            ICollection <Project> projects = _projRepo.GetProjs(searchProjectsViewModel.SortBy,
                                                                searchProjectsViewModel.StatusFilter, searchProjectsViewModel.KeyWords);

            foreach (Project proj in projects)
            {
                proj.Valuation = _projRepo.GetValuationById(proj.ProjectId);
            }
            searchProjectsViewModel.Projects    = projects;
            searchProjectsViewModel.CurrentUser = await _userManager.GetUserAsync(User); //we can't pass current user from the view using "<input type="hidden" asp-for="CurrentUser", we can only pass string/int

            return(View(searchProjectsViewModel));
        }
示例#2
0
        public async Task <ViewResult> SearchProjects()
        {
            ICollection <Project> projects = _projRepo.GetProjs(ProjSearchCriteria.ByOpenDate, ProjSearchCriteria.OpenOnly, null);

            foreach (Project proj in projects)
            {
                proj.Valuation = _projRepo.GetValuationById(proj.ProjectId);
            }
            SearchProjectsViewModel searchProjectsViewModel = new SearchProjectsViewModel
            {
                Projects    = projects,
                CurrentUser = await _userManager.GetUserAsync(User)
            };

            return(View(searchProjectsViewModel));
        }