Example #1
0
        public async Task <ActionResult> ApproveOrderAsync([FromBody] ApproveOrderRequest data)
        {
            // Step 1: Check if user is a room manager
            var room = await roomApiClient.GetAsync(data.RoomId);

            if (room == null)
            {
                return(new BadRequestResult());
            }

            // Step 2: Approve order
            var statusCode = await orderClient.ApproveOrderAsync(data.OrderId, room.ManagerId);

            if (statusCode == HttpStatusCode.BadRequest)
            {
                return(BadRequest());
            }

            return(NoContent());
        }