public async Task <ActionResult> Index(string ChatMessage) { Chat objChat = new Chat(); var oldResponse = ""; if (System.Web.HttpContext.Current.Session["ChatResponse"] != null) { oldResponse = System.Web.HttpContext.Current.Session["ChatResponse"].ToString(); } if (System.Web.HttpContext.Current.Session["User"] == null) { System.Web.HttpContext.Current.Session["User"] = "******" + Guid.NewGuid().ToString(); } if (!String.IsNullOrEmpty(ChatMessage) && ChatMessage.Length > 0) { var talker = new BotTalker(); objChat = await talker.TalkToTheBot(ChatMessage, System.Web.HttpContext.Current.Session["User"].ToString(), System.Web.HttpContext.Current.Session["User"].ToString()); objChat.ChatResponse = oldResponse + "<b>" + ChatMessage + "</b></br></br>" + objChat.ChatResponse + "</br>"; System.Web.HttpContext.Current.Session["ChatResponse"] = objChat.ChatResponse; } ModelState.Clear(); return(View(new Chat { ChatResponse = objChat.ChatResponse })); }
public async Task <Chat> Post(ChatMessage message) { System.Web.HttpContext.Current.Session["User"] = message.Username; var talker = new BotTalker(); //var objChat = await talker.TalkToTheBot(message.Text); //var response = new ChatResponse { Text = objChat.ChatResponse }; return(await talker.TalkToTheBot(message.Text, message.Username, message.Conversation)); }