public ActionResult PrintSearchResult(UsersSearchResult usersSearchResult) { UsersSearchResultViewModel usersSearchResultViewModel = new UsersSearchResultViewModel(); usersSearchResultViewModel.SpecifyingSkillsForSearchSaveModel = usersSearchResult.SpecifyingSkillsForSearch; usersSearchResultViewModel.UserSearchListResultViewModel = usersSearchResult.Users; var report = new ViewAsPdf("_SearchResultPartial", usersSearchResultViewModel); return(report); }
public async Task <ActionResult> Index(List <SpecifyingSkillForSearchSaveModel> specifyingSkillsForSearchSaveModel, UsersSearchResult usersSearchResult) { UsersSearchResultViewModel usersSearchResultViewModel = new UsersSearchResultViewModel(); if (ModelState.IsValid) { int idForMinLevelValue = await _userService.GetIdForMinLevelValue(); // clear search criteria specifyingSkillsForSearchSaveModel.RemoveAll(x => x.LevelId == idForMinLevelValue && !x.OrHigher); usersSearchResultViewModel.SpecifyingSkillsForSearchSaveModel = specifyingSkillsForSearchSaveModel; usersSearchResultViewModel.UserSearchListResultViewModel = new List <UserSearchResultViewModel>(); var specifyingSkillForSearchDTO = _mapper.Map <IEnumerable <SpecifyingSkillForSearchSaveModel>, IEnumerable <SpecifyingSkillForSearchDTO> > (specifyingSkillsForSearchSaveModel); var usersId = _userService.GetUsersIdByCriteria(specifyingSkillForSearchDTO); IEnumerable <UserViewModel> Users = from id in usersId join user in _identityService.GetUsers().ProjectTo <UserViewModel>(_mapper.ConfigurationProvider) on id equals user.Id select user; usersSearchResultViewModel.UserSearchListResultViewModel = (from u in Users select new UserSearchResultViewModel() { User = new UserViewModel() { Id = u.Id, Name = u.Name }, SpecifyingSkills = GetFilledSpecifyingSkillsForUser(u.Id) }).ToList(); } // save search result on client side to pass them to PrintSearch usersSearchResult.SpecifyingSkillsForSearch = usersSearchResultViewModel.SpecifyingSkillsForSearchSaveModel; usersSearchResult.Users = usersSearchResultViewModel.UserSearchListResultViewModel; return(View("SearchResult", usersSearchResultViewModel)); }