// GET: /<controller>/ public IActionResult Index(string employee, [FromServices] IRepository <EmployeeHistory> empHistory, [FromServices] IOrganigramaModelFactory organigramaFactory) { var orgData = organigramaFactory.GetEmployeeData(employee); var history = empHistory.SearhItemsFor(e => e.EmployeeId.Equals(orgData.GeneralInfo.Id)); EmployeeHistoryModel model = new EmployeeHistoryModel() { EmployeeId = employee, Area = orgData.Area, JobCenter = orgData.JobCenter, FirstName = orgData.GeneralInfo.FirstName, LastName = orgData.GeneralInfo.LastName, EmployeeHistory = history.Select(y => new EmployeeHistoryItem() { DateChange = y.DateChange.ToShortDateString(), Descripcion = y.Descripcion, EmployeeId = y.EmployeeId, JobActual = y.JobActual, JobLast = y.JobLast, RegisterDate = y.RegisterDate.ToShortDateString(), UserId = y.UserId, Id = y.Id }).ToList() }; return(View(model)); }
public ActionResult EmployeeHistory(empleados employee) { TempData.Keep(); if (employee.cedulaPK != null) { List <EmployeeHistoryModel> employeeHistory = new List <EmployeeHistoryModel>(); List <roles> employeeRoles = new rolesController().getEmployeeRoles(employee.cedulaPK); foreach (roles rol in employeeRoles) { EmployeeHistoryModel participation = new EmployeeHistoryModel(); participation.projectName = new proyectosController().getProjectName(rol.codigoProyectoFK); participation.executedRole = rol.rol; int?requirementsDays = new requerimientosController().GetRequirementsDays(rol.codigoProyectoFK, rol.cedulaFK); if (requirementsDays != null && rol.rol == "Desarrollador") { participation.dedicatedHours = (int)requirementsDays * 8; } employeeHistory.Add(participation); } TempData["employeeHistory"] = employeeHistory; } return(View()); }