// GET: ChatRoom public ActionResult ChatRoom(ChatRoomModel.Messages msg) { bussinessChat = new ChatRoomBussiness(); if (!string.IsNullOrEmpty(msg.Message)) { bussinessChat._userId = TempData["userId"]?.ToString() ?? "0"; bussinessChat._message = msg.Message; bussinessChat.PostMessage(); if (bussinessChat.isCommand) { botMessageResponse = JsonConvert.DeserializeObject <ChatRoomModel.Messages>(bussinessChat.bootMessage); } TempData.Keep("userId"); } string jsonmessages = bussinessChat.RetriveMessages(); if (botMessageResponse != null) { messageList.Add(botMessageResponse); } messageList.AddRange(JsonConvert.DeserializeObject <List <ChatRoomModel.Messages> >(jsonmessages)); ViewData["messageList"] = messageList; return(View()); }
public void PostMessageBotTest() { bo = new ChatRoomBussiness(); bo._userId = "1"; bo._message = "/stock=stock_code"; int rows = bo.PostMessage(); Assert.IsTrue(rows > 0); }
public void PostMessageTest() { bo = new ChatRoomBussiness(); bo._userId = "1"; bo._message = "Mensaje de prueba"; int rows = bo.PostMessage(); Assert.IsTrue(rows > 0); }
public ActionResult postMessage(ChatRoomModel.Messages msg) { ChatRoomBussiness bussiness = new ChatRoomBussiness(); bussiness._userId = TempData["userId"]?.ToString() ?? "0"; bussiness._message = msg.Message; bussiness.PostMessage(); TempData.Keep("userId"); return(RedirectToAction("ChatRoom", "ChatRoom")); }