public async Task <ActionResult <OrderResponseModel> > UpdateShipperOrder(int shipperId, int orderId, ShipperOrderModel orderModel) { await DoesShipperExist(shipperId); var oldOrder = await _shipperService.GetOrderById(orderId); if (oldOrder == null) { throw new ProblemDetailsException(StatusCodes.Status404NotFound, $"Order with id {orderId} not found"); } var newOrder = _mapper.Map(orderModel, oldOrder); _shipperService.UpdateEntity(shipperId, newOrder); if (await _shipperService.IsSavedToDb()) { return(Ok(_mapper.Map <OrderResponseModel>(newOrder))); } return(BadRequest()); }