public JsonResult GetEmploymentHistoryList() { var employmentHistoryListObj = this.employmentHistoryService.GetAllEmploymentHistory(); List <EmploymentHistoryModel> employmentHistoryVMList = new List <EmploymentHistoryModel>(); foreach (var employmentHistory in employmentHistoryListObj) { EmploymentHistoryModel employmentHistoryTemp = new EmploymentHistoryModel(); employmentHistoryTemp.Id = employmentHistory.Id; //employmentHistoryTemp.Name = employmentHistory.Name; //employmentHistoryTemp.Code = employmentHistory.Code; employmentHistoryVMList.Add(employmentHistoryTemp); } return(Json(employmentHistoryVMList, JsonRequestBehavior.AllowGet)); }
public JsonResult GetEmployeeListByDesignationId(int id) //id is designationId { var employeeListObj = this.employmentHistoryService.GetAllEmploymentHistory().Where(a => a.DesignationId == id).ToList(); List <EmploymentHistoryModel> employmentHistoryVMList = new List <EmploymentHistoryModel>(); if (employeeListObj != null) { foreach (var employee in employeeListObj) { EmploymentHistoryModel employmentHistoryTemp = new EmploymentHistoryModel(); employmentHistoryTemp.Id = employee.Id; employmentHistoryTemp.EmployeeId = employee.EmployeeId; if (employee.Employee != null) { employmentHistoryTemp.EmployeeName = employee.Employee.FullName; } employmentHistoryVMList.Add(employmentHistoryTemp); } } return(Json(employmentHistoryVMList, JsonRequestBehavior.AllowGet)); }