Skip to content

Commit 71a93f2

Browse files
committed
Fix GetOrdersByShipperId bug
1 parent c5831a8 commit 71a93f2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

NorthwindCRUD/Controllers/OrdersController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ public ActionResult<CustomerDto> GetShipperByOrderId(int id)
222222
try
223223
{
224224
var order = this.orderService.GetById(id);
225-
if (order != null)
225+
if (order?.ShipperId != null)
226226
{
227-
var shipper = this.shipperService.GetById(order.ShipVia);
227+
var shipper = this.shipperService.GetById(order.ShipperId.Value);
228228

229229
if (shipper != null)
230230
{

NorthwindCRUD/Services/OrderService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public OrderDb[] GetOrdersByEmployeeId(int id)
7373
public OrderDb[] GetOrdersByShipperId(int id)
7474
{
7575
return GetOrdersQuery()
76-
.Where(o => o.ShipVia == id)
76+
.Where(o => o.ShipperId == id)
7777
.ToArray();
7878
}
7979

0 commit comments

Comments
 (0)