コード例 #1
0
        public async Task <IActionResult> CreateBotAction(BotAction botAction)
        {
            if (botAction == null)
            {
                return(BadRequest());
            }

            if (botService.GetBotActions().Any(x => x.Command == botAction.Command
                                               & x.Parameters == botAction.Parameters))
            {
                return(UnprocessableEntity("Bot action already added"));
            }

            await botService.CreateBotAction(botAction);

            return(CreatedAtRoute("GetBotAction", new { id = botAction.Id }, botAction));
        }