Create a Server Action named GetOrdersByStatus, receive the status of the Order, and return the number of orders according to the status. (If OrderStatusId is null, the sum of all orders will be returned)

I would like to know how to define the aggregate of the input parameter and how to define the assign of the output parameter when there is a problem.

Quite simple friend,

its enough to make the condition like:
OrderStatusId   -> input parameter

OrderStatusId  = NullIdentifier() or OrderStatusId = Order.OrderStatusId