Пример #1
0
        /// <summary>
        /// Fetches chatbot or creates if it doesn't exist
        /// </summary>
        /// <returns></returns>
        protected virtual async Task <Domain.ChatBot> GetChatBotAsync()
        {
            Domain.ChatBot chatBotModel = null;
            if (await _chatBotService.Exists(cb => cb.Name == this._chatBotName))
            {
                chatBotModel = await _chatBotService.FindBy(cb => cb.Name == this._chatBotName);
            }
            else
            {
                chatBotModel = await _chatBotService.Create(new Domain.ChatBot {
                    Name = this._chatBotName
                });
            }

            return(chatBotModel);
        }
 private async Task <bool> ChatBotExists(int id)
 {
     return(await _chatBotService.Exists(e => e.ChatBotId == id));
 }