public IActionResult Details() { List <EmployeeDepartmentVM> model = new List <EmployeeDepartmentVM>(); EmpService.GetAll().ToList().ForEach(emp => { var DetName = DeptService.Get(emp.DeptId).DeptName; model.Add(new EmployeeDepartmentVM { DeptName = DetName, Name = emp.Name, Salary = emp.Salary }); }); return(View(model)); }
public async Task <ActionResult <Department> > GetEmployee(int id) { try { var res = await departmentRepositry.Get(id); if (res == null) { return(NotFound()); } return(res); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "Error")); } }