public EditJobHistoryViewModel(JobHistoryViewModel jobHistoryToEdit, JobHistoryService historyService) { HistoryToEdit = jobHistoryToEdit; _historyService = historyService; JobHistoryId = jobHistoryToEdit.HistoryId; CandidateNum = jobHistoryToEdit.CandidateNum; CompanyId = jobHistoryToEdit.CompanyId; CopyFields(HistoryToEdit); }
private void CopyFields(JobHistoryViewModel historyToEdit) { Candidate = historyToEdit.CandidateName; Company = historyToEdit.CompanyName; WorkedFrom = DateTime.Parse(historyToEdit.WorkedFrom); WorkHours = historyToEdit.WorkedHours; if (TryParse(historyToEdit.WorkedTo, out DateTime result)) { WorkedTo = result; } }
public void SearchJobHistory(string searchString) { JobHistoryList.Clear(); var histories = _jobHistoryService.SearchJobHistories(searchString); foreach (var history in histories) { var historyModel = new JobHistoryViewModel(history); JobHistoryList.Add(historyModel); } }
public void Add() { var jobHistory = new JobHistory { CandidateNumber = SelectedCandidate.CandidateNumber, CompanyId = SelectedCompany.CompanyId, WorkedFrom = WorkedFrom }; if (WorkedTo != null) { jobHistory.WorkedTo = WorkedTo; } if (WorkedHours != null) { jobHistory.WorkedHours = WorkedHours; } _jobHistoryService.AddJobHistory(jobHistory); AssociatedJobHistory = new JobHistoryViewModel(jobHistory); }