public IActionResult Index( ) { var employees = _employeeHandler.GetEmployees().ToList(); var levels = _levelHandler.LevelTypes.ToList(); var tasks = _taskHandler.TaskTypes.ToList(); var dahsboardVM = new DashboardVIewModel { Employees = employees, Levels = levels, Tasks = tasks }; return(View(dahsboardVM)); }
public async Task <ActionResult <IEnumerable <EmployeeDto> > > GetEmployees() { try { var employees = await _employeeHandler.GetEmployees(); var employeeResponse = _mapper.Map <IEnumerable <EmployeeDto> >(employees); return(Ok(employeeResponse)); } catch (Exception e) { return(StatusCode(500, "Internal server error")); } }
public IActionResult Employees() { ViewData["Levels"] = new SelectList(_levelHandler.LevelTypes.Select(u => new SelectListItem() { Value = u.LevelTypeId.ToString(), Text = $"{u.Description }" }), "Value", "Text"); try { var _employees = _employeeHandler.GetEmployees(); return(View(_employees)); } catch (Exception ex) { ViewBag.ErrorMessage = ex.Message; return(View(new EmploymentViewModel())); } }