public IActionResult Buy(ItemRequest item)
        {
            var response = shopService.Buy(item.ItemId, item.Quantity);

            if (response)
            {
                return(Ok());
            }

            return(BadRequest());
        }
예제 #2
0
        public async Task Buy(Interaction interaction)
        {
            var user   = _userRepository.GetUser(interaction.UserId);
            var shopId = interaction.BlockId.Split(":").First();
            var shop   = _shopRepository.GetShop(shopId);

            var response = _shopService.Buy(user, interaction.Value);

            await _slack.SendEphemeralMessage(response.Message, user.Id, interaction.ChannelId);

            await _slack.UpdateInteractionMessage(new ShopMenu(shop, user, _itemRepository, _governmentService).Blocks, interaction.ResponseUrl);
        }
예제 #3
0
        public ActionResult Interaction([FromForm] SlackInteractionDto slackInteraction)
        {
            var interaction = slackInteraction.ToInteraction();

            if (interaction.Action == "buy")
            {
                _shopService.Buy(interaction);
                return(Ok());
            }

            if (interaction.Action == "inventory")
            {
                return(Ok(InventoryInteractions(interaction)));
            }

            return(Ok());
        }