Skip to content

Commit d247434

Browse files
authored
Merge pull request #53 from IgniteUI/dgdimitrov/get-empoyee-by-id-include-address
Include address in employee getbyid
2 parents 083dd58 + f0bfd80 commit d247434

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

NorthwindCRUD/Services/EmployeeService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ public IQueryable<EmployeeDb> GetAllAsQueryable()
2828

2929
public EmployeeDb? GetById(int id)
3030
{
31-
return this.dataContext.Employees.FirstOrDefault(c => c.EmployeeId == id);
31+
return this.dataContext.Employees
32+
.Include(x => x.Address)
33+
.FirstOrDefault(c => c.EmployeeId == id);
3234
}
3335

3436
public EmployeeDb[] GetEmployeesByReportsTo(int id)

0 commit comments

Comments
 (0)