public async Task <ActionResult> GetEmployees() { try { return(Ok(await employeeRepositry.GetAll())); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "Error")); } }
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)); }