File tree Expand file tree Collapse file tree 3 files changed +6
-2
lines changed
Expand file tree Collapse file tree 3 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ public ActionResult<EmployeeDto> GetById(int id)
6060 }
6161 }
6262
63+ // TODO Add additional data in order to support this endpoint
6364 [ HttpGet ( "{id}/Superior" ) ]
6465 [ Authorize ]
6566 public ActionResult < EmployeeDto > GetSuperiorById ( int id )
@@ -111,7 +112,7 @@ public ActionResult<OrderDto[]> GetOrdersByEmployeeId(int id)
111112 var employee = this . employeeService . GetById ( id ) ;
112113 if ( employee != null )
113114 {
114- return Ok ( this . mapper . Map < OrderDb [ ] , OrderDto > ( employee . Orders . ToArray ( ) ) ) ;
115+ return Ok ( this . mapper . Map < OrderDb [ ] , OrderDto [ ] > ( employee . Orders . ToArray ( ) ) ) ;
115116 }
116117
117118 return NotFound ( ) ;
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ public CustomerDb GetById(string id)
2525 {
2626 return this . dataContext . Customers
2727 . Include ( c => c . Address )
28- . Include ( c => c . Orders . Where ( o => o . CustomerId == id ) )
28+ . Include ( c => c . Orders . Where ( o => o . CustomerId == id ) )
2929 . FirstOrDefault ( c => c . CustomerId == id ) ;
3030 }
3131
Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ public EmployeeDb GetById(int id)
2424 {
2525 return this . dataContext . Employees
2626 . Include ( c => c . Address )
27+ . Include ( c => c . Orders . Where ( o => o . EmployeeId == id ) )
28+ . Include ( c => c . EmployeesTerritories . Where ( o => o . EmployeeId == id ) )
29+ . ThenInclude ( t => t . Territory )
2730 . FirstOrDefault ( c => c . EmployeeId == id ) ;
2831 }
2932
You can’t perform that action at this time.
0 commit comments