private void UpdateCandidate(Candidate candidate, DesiredJobMemberModel memberModel) { // Desired job. candidate.DesiredJobTitle = memberModel.DesiredJobTitle; candidate.DesiredJobTypes = memberModel.DesiredJobTypes; // Salary. candidate.DesiredSalary = new Salary { Currency = Currency.AUD, LowerBound = memberModel.DesiredSalaryLowerBound, Rate = memberModel.DesiredSalaryRate }; // Status. if (memberModel.Status != CandidateStatus.Unspecified) { candidate.Status = memberModel.Status; } // Relocation. candidate.RelocationPreference = memberModel.RelocationPreference; candidate.RelocationLocations = GetRelocationLocations(memberModel.RelocationCountryIds, memberModel.RelocationCountryLocationIds); }
public ActionResult DesiredJob(DesiredJobMemberModel memberModel) { try { var member = CurrentMember; var candidate = _candidatesQuery.GetCandidate(member.Id); var resume = candidate.ResumeId == null ? null : _resumesQuery.GetResume(candidate.ResumeId.Value); // Check. memberModel.Prepare(); memberModel.Validate(); // Update. UpdateMember(member, m => UpdateMember(m, memberModel)); UpdateCandidate(candidate, c => UpdateCandidate(c, memberModel)); UpdateSuggestedJobs(member.Id, memberModel.SendSuggestedJobs); return(Json(new JsonProfileModel { Profile = CreateProfileModel(member, candidate, resume) })); } catch (UserException ex) { ModelState.AddModelError(ex, new StandardErrorHandler()); } return(Json(new JsonResponseModel())); }
private static void UpdateMember(IMember member, DesiredJobMemberModel memberModel) { member.VisibilitySettings.Professional.EmploymentVisibility = member.VisibilitySettings.Professional.EmploymentVisibility.SetFlag(ProfessionalVisibility.Salary, !memberModel.IsSalaryNotVisible); }