public IActionResult OrderDetail([FromQuery] int restaurantID, int menuID)
        {
            int query_result = business_Repo.ItemInStock(restaurantID, menuID);

            if (query_result > 0)
            {
                return(Ok(restaurantID));
            }
            return(this.StatusCode((int)HttpStatusCode.InternalServerError, "error"));
        }
        private async Task ProcessMessagesAsync(Message message, CancellationToken token)
        {
            var id = JsonConvert.DeserializeObject <object>(Encoding.UTF8.GetString(message.Body));

            var result = _restaurantBusiness.ItemInStock(1, 2);

            await subscriptionClient.CompleteAsync(message.SystemProperties.LockToken);

            // Note: Use the cancellationToken passed as necessary to determine if the subscriptionClient has already been closed.
            // If subscriptionClient has already been closed, you can choose to not call CompleteAsync() or AbandonAsync() etc.
            // to avoid unnecessary exceptions.
        }
        public IActionResult OrderDetail([FromQuery] int restaurantID, int menuID)
        {
            string msg          = "Item out of Stock";
            int    query_result = business_Repo.ItemInStock(restaurantID, menuID);

            if (query_result > 0)
            {
                return(Ok(restaurantID));
            }
            else
            {
                messagePublisher.SendMessagesAsync(msg);
            }

            return(this.StatusCode((int)HttpStatusCode.InternalServerError, "error"));
        }
Beispiel #4
0
        async Task ProcessMessagesAsync(Message message, CancellationToken token)
        {
            string msg = Encoding.UTF8.GetString(message.Body);

            var        stockEntity = JsonConvert.DeserializeObject <StockItems>(Encoding.UTF8.GetString(message.Body));
            StockItems cart        = new StockItems
            {
                RestaurantId = stockEntity.RestaurantId,
                MenuId       = stockEntity.MenuId,
                CustomerId   = stockEntity.CustomerId
            };

            _restaurantBusiness.ItemInStock(cart.RestaurantId, cart.MenuId, cart.CustomerId);


            await _subscriptionClient.CompleteAsync(message.SystemProperties.LockToken);

            await _subscriptionClient.CloseAsync();
        }