public IActionResult Search(ProfileSearchViewModel vm)
        {
            List <ProfileSearchResultViewModel> result = new List <ProfileSearchResultViewModel>();

            if (ModelState.IsValid)
            {
                DateTime minDate = DateTime.Today.AddYears(-vm.MaxAge);
                DateTime maxDate = DateTime.Today.AddYears(-vm.MinAge);

                result = (from p in _context.Profiles
                          where p.Gender == vm.Gender &&
                          p.Height > vm.MinHeight && p.Height <vm.MaxHeight &&
                                                               p.Birthday> minDate && p.Birthday < maxDate &&
                          (!vm.NoSmoking || (vm.NoSmoking && p.Smoking == SmokerType.No))
                          select new ProfileSearchResultViewModel
                {
                    Description = p.Description,
                    Id = p.Id,
                    ProfilePicture = $"{p.User.Id}/{p.ProfilePicture}",
                    Gender = p.Gender,
                    Smoking = p.Smoking,
                    Occupation = p.Occupation,
                    DisplayName = p.DisplayName,
                    Height = p.Height,
                    Age = calculateAge(p.Birthday)
                }).ToList();
            }

            return(View("Result", result)); //show result in "Result" view
        }
        public IActionResult Search()
        {
            ProfileSearchViewModel vm = new ProfileSearchViewModel();

            vm.MinAge = 18;
            vm.MaxAge = 85;

            return(View(vm));
        }
        public ActionResult Search(ProfileSearchViewModel svm)
        {
            // TODO: ProfileResultViewModel aanpassen
            // TODO: code om te filteren op wat er in de svm staat

            var profiles = db.Profiles.Include(p => p.ProfilePicture);

            // TODO: View scaffolden
            return(View(profiles.ToList()));
        }
Beispiel #4
0
        public List <ProfileViewModel> GetCandidateProfiles(ProfileSearchViewModel model)
        {
            var profiles = _businessLayer.GetAllProfileInfoByCandidateId(model.Id);


            List <ProfileViewModel> list = new List <ProfileViewModel>();


            foreach (var profile in profiles)
            {
                var companyName = _businessLayer.GetAllCompany().Where(x => x.CompanyId == profile.CompanyId).Select(y => y.Name).FirstOrDefault();
                list.Add(new ProfileViewModel
                {
                    AppliedPositionFor = profile.AppliedPositionFor,
                    CandidateId        = profile.CandidateId,
                    CompanyContact     = profile.CompanyContact,
                    CompanyDetails     = profile.CompanyDetails,
                    CompanyName        = companyName,
                    CompanyId          = profile.CompanyId,
                    CurrentStatus      = profile.CurrentStatus,
                    DateOfInterview    = profile.DateOfInterview.HasValue ? profile.DateOfInterview.Value.ToShortDateString() : null,
                    HRCopy             = profile.HRCopy,
                    IndustryId         = profile.IndustryId,
                    Interviewer        = profile.Interviewer,
                    InterviewerContact = profile.InterviewerMobile,
                    ProfileId          = profile.ProfileId,
                    RecruiterContact   = profile.ContactOfRecruiter,
                    RecruiterName      = profile.NameOfRecruiter,
                    ReferenceType      = profile.ReferenceType,
                    TeamLeadName       = profile.TeamLeadName
                });
            }

            return(list);


            //List <ProfileViewModel> profiles = new List<ProfileViewModel>();
            //for (int i = 0; i < 100; i++)
            //{
            //    profiles.Add(new ProfileViewModel
            //    {
            //        CandidateId = 1,
            //        ProfileId = i + 1,
            //        CurrentStatus = "InProgress"

            //    });
            //}
            //return profiles;
        }
Beispiel #5
0
        public ActionResult Search(string search)
        {
            if (search == null)
            {
                search = "";
            }

            var profiles = UnitOfWork.ProfileRepository.SearchProfiles(search);


            var currentId = User.Identity.GetUserId();
            int profileId = UnitOfWork.ProfileRepository.GetProfileId(currentId);

            var profilesSearchViewModel = new ProfilesSearchViewModel();

            var contacts = UnitOfWork.ContactRepository.FindAllContacts(profileId);

            foreach (var profile in profiles)
            {
                if (profile.Id != profileId && profile.Active == true)
                {
                    bool isContact = false;

                    // Kontrollerar om användaren i resultatet redan är kontakt med den inloggade användaren
                    if (contacts.Contains(profile.Id))
                    {
                        isContact = true;
                    }

                    var profileSearchViewModel = new ProfileSearchViewModel(profile, isContact, GetMatchPercentage(profile.Id));
                    profilesSearchViewModel.Profiles.Add(profileSearchViewModel);
                }
            }

            profilesSearchViewModel.Profiles = profilesSearchViewModel.Profiles.OrderByDescending(x => x.MatchPercentage).ToList();

            return(View(profilesSearchViewModel));
        }
Beispiel #6
0
 public ActionResult Search(ProfileSearchViewModel svm)
 {
     return(View());
 }