public async Task <IActionResult> GetRequests( [BindRequired][FromQuery] int employeeId) { if (!_employees.EmployeeExists((uint)employeeId)) { return(NotFound(employeeId)); } var employee = await Task.Run(() => _employees.GetEmployee((uint)employeeId)); var requests = await Task.Run(() => _requests.GetRequests(employee)); return(Ok(requests.Select(r => new { Id = r.Id, EmployeeId = r.Requester.Id, Day = r.Day, Hours = r.Hours }))); }
public async Task <IActionResult> GetEmployee( [BindRequired][FromRoute] int id) { if (!_employees.EmployeeExists((uint)id)) { return(NotFound(id)); } var employee = await Task.Run(() => _employees.GetEmployee((uint)id)); return(Ok(employee)); }