public async Task <IActionResult> AddProjectEmployees(int id) { try { var employeeDtos = await _employeeService.GetEmployeeAsync().ConfigureAwait(false); return(View(EmployeeMapper.MapEst(employeeDtos).Select(x => { x.ProjectId = id; return x; }).ToList())); } catch (Exception) { ErrorViewModel model = new ErrorViewModel { RequestId = "Medarbejderen kunne ikke tilknyttes projektet" }; return(View("Error", model)); } }
//private bool EmployeeViewModelExists(int id) //{ // try // { // return _context.Employees.Any(e => e.Id == id); // } // catch (Exception) { throw; } //} // GET: Employee public async Task <IActionResult> AddProjectEmployee(int id, string searchString) { try { IEnumerable <EmployeeDto> employeeDtos = await _employeeService.GetChosenEmployees(searchString); var projects = EmployeeMapper.MapEst(employeeDtos).Select(x => { x.ProjectId = id; return(x); }).ToList(); return(View(EmployeeMapper.MapEst(employeeDtos).Select(x => { x.ProjectId = id; return x; }).ToList())); } catch (Exception) { ErrorViewModel model = new ErrorViewModel { RequestId = "Medarbejderen kunne ikke vises" }; return(View("Error", model)); } }