public ActionResult UserSearch() { //List<UserProfileModel> lstUserProfile = UserProfileMap.Map(_repoUserProfile.GetList().ToList()); ProfileSearchModel objProfileSearch = new ProfileSearchModel(); return(PartialView("ProfileSearch", objProfileSearch)); }
private async Task <ProfileSearchModel> GetProfile(ProfileSearchModel model) { if (model == null) { model = new ProfileSearchModel(); } var result = await _search.FindUser(model); var list = new List <(User, UserSpecializations, Profskills[])>();
public ActionResult Profile() { UserProfileModel objUserProfile = new UserProfileModel(); //_repoFile.GetList(x=>x. if (CurrentRole != "Administrator") { var objProfile = _repoUserProfile.GetSingle(x => x.UserId == CurrentUser.UserId); if (objProfile != null) { ViewBag.DisciplineId = new SelectList(_repoDiscipline.GetList(x => x.CategoryId == objProfile.CategoryId).ToList(), "Id", "DisciplineName", objProfile.DisciplineId); ViewBag.ProvinceId = new SelectList(_repoProvince.GetList(x => x.Country == objProfile.CountryName).ToList(), "Id", "Name_1", objProfile.StateId); objUserProfile = UserProfileMap.Map(objProfile); objUserProfile.IsNew = false; var objEntityFile = _repoEntityFile.GetSingle(x => x.EntityId == objProfile.Id && x.SectionId == 1); if (objEntityFile != null) { objUserProfile.FileId = objEntityFile.FileId.GetValueOrDefault(); } } else { objUserProfile.IsNew = true; } } else { var objProfile = _repoUserProfile.GetSingle(x => x.UserId == CurrentUser.UserId); if (objProfile == null) ////This condition is to check if user has a profile or not { objUserProfile.IsNew = true; } List <UserProfileModel> lstUserProfile = UserProfileMap.Map(_repoUserProfile.GetList(x => x.StatusId == 0).ToList()); ViewBag.TotalUserList = lstUserProfile.Count; } ViewBag.CurrentMainTab = "Home"; ViewBag.CurrentSubTab = "ControlPanel"; ViewBag.CurrentSuperSubTab = "Profile"; ProfileSearchModel objProfileSearch = new ProfileSearchModel(); objUserProfile.ProfileSearch = objProfileSearch; return(View(objUserProfile)); }
public async Task <IQueryable <User> > FindUser(ProfileSearchModel model) { var all = _users.GetAllUser(); if (model == null) { return(all); } all = await FilterBySpheresAnsSpecs(all, model); all = await FilterByProfSkills(all, model); return(all); }
public void Verify_Search_WithPaging_Should_ReturnAListOfProfilesWithDataMatchingSearchParameters() { // Arrange Mock <IDbSet <Profile> > mockSetProfiles; var mockContext = ProfilesMockingSetup.DoMockingSetupForContext(true, out mockSetProfiles); var repository = new ProfilesRepository(mockContext.Object); var searchModel = new ProfileSearchModel { Paging = new Paging { Skip = 1, Take = 1 } }; // Act var profiles = repository.Search(searchModel /*.Object*/).ToArray(); // Assert Assert.Equal(1, profiles.Length); Assert.Equal(2, profiles[0].Id); Assert.Equal("/TEST/NIVEN-LARRY", profiles[0].ApiDetailUrl); // Stephen King was filtered out because he was Skipped }
public void Verify_Search_WithModifiedSince_Should_ReturnAListOfProfilesWithDataMatchingSearchParameters() { // Arrange Mock <IDbSet <Profile> > mockSetProfiles; var mockContext = ProfilesMockingSetup.DoMockingSetupForContext(true, out mockSetProfiles, true); var repository = new ProfilesRepository(mockContext.Object); var createDate = new System.DateTime(2015, 05, 28, 10, 45, 00).AddDays(1).AddMinutes(-1); //var searchModel = new Mock<IProfileSearchModel>(); //searchModel.Setup(m => m.ModifiedSince).Returns(() => createDate); var searchModel = new ProfileSearchModel { ModifiedSince = createDate }; // Act var profiles = repository.Search(searchModel /*.Object*/).ToArray(); // Assert Assert.Equal(1, profiles.Length); Assert.Equal(2, profiles[0].Id); Assert.Equal("/TEST/NIVEN-LARRY", profiles[0].ApiDetailUrl); // Stephen King was filtered out because he was created before the modified since date }
private void SelectedItem(object obj) { ProfileSearchModel item = obj as ProfileSearchModel; NavigationService.Navigate(typeof(ProfilePage.ProfilePage), item.IdUser); }
private async Task <IQueryable <User> > FilterByProfSkills(IQueryable <User> users, ProfileSearchModel model) { if (model.ProfSkills == null) { return(users); } if (users.Count() == 0) { return(users); } var result = _users.GetAllProfskills().Join(users, x => x.UserId, y => y.Id, (x, y) => x) .Where(x => model.ProfSkills.Contains(x.Name)) .Include(x => x.User) .Select(x => x.User); return(result); }
private async Task <IQueryable <User> > FilterBySpheresAnsSpecs(IQueryable <User> users, ProfileSearchModel model) { if (model.SphereId == null) { return(users); } if (users.Count() == 0) { return(users); } var sphere = (await _spheres.FindSpheres(x => x.Id == model.SphereId)).FirstOrDefault(); var result = _users.GetAllUserSpecializations() .Where(x => x.SphereId == model.SphereId); if (model.SpecializationId != null) { result = result.Where(x => x.SpecializationId == model.SpecializationId); } return(result.Join(users, x => x.UserId, y => y.Id, (x, y) => y)); }
public PartialViewResult SearchFilters() { ProfileSearchModel objProfileSearch = new ProfileSearchModel(); return(PartialView("_SearchFilterPartial", objProfileSearch)); }
public async Task <IActionResult> ProfileSeacrh(ProfileSearchModel model) { model = await GetProfile(model); return(View("ProfileSearch", model)); }
public void Verify_Search_WithPaging_Should_ReturnAListOfProfilesWithDataMatchingSearchParameters() { // Arrange Mock<IDbSet<Profile>> mockSetProfiles; var mockContext = ProfilesMockingSetup.DoMockingSetupForContext(true, out mockSetProfiles); var repository = new ProfilesRepository(mockContext.Object); var searchModel = new ProfileSearchModel { Paging = new Paging { Skip = 1, Take = 1 } }; // Act var profiles = repository.Search(searchModel/*.Object*/).ToArray(); // Assert Assert.Equal(1, profiles.Length); Assert.Equal(2, profiles[0].Id); Assert.Equal("/TEST/NIVEN-LARRY", profiles[0].ApiDetailUrl); // Stephen King was filtered out because he was Skipped }
public void Verify_Search_WithModifiedSince_Should_ReturnAListOfProfilesWithDataMatchingSearchParameters() { // Arrange Mock<IDbSet<Profile>> mockSetProfiles; var mockContext = ProfilesMockingSetup.DoMockingSetupForContext(true, out mockSetProfiles, true); var repository = new ProfilesRepository(mockContext.Object); var createDate = new System.DateTime(2015, 05, 28, 10, 45, 00).AddDays(1).AddMinutes(-1); //var searchModel = new Mock<IProfileSearchModel>(); //searchModel.Setup(m => m.ModifiedSince).Returns(() => createDate); var searchModel = new ProfileSearchModel { ModifiedSince = createDate }; // Act var profiles = repository.Search(searchModel/*.Object*/).ToArray(); // Assert Assert.Equal(1, profiles.Length); Assert.Equal(2, profiles[0].Id); Assert.Equal("/TEST/NIVEN-LARRY", profiles[0].ApiDetailUrl); // Stephen King was filtered out because he was created before the modified since date }