public JsonResult LoadUserTalk(string uid) { List<ChatContent> chats = new List<ChatContent>(); string to = string.Empty; UsersEntity user = new UsersEntity(); ChatBLL cbll = new ChatBLL(); if (Session["User"] != null) { user = Session["User"] as UsersEntity; //uid ==fromuid ,user.id ==currentuser chats = cbll.GetUserChat(uid,user.Id); } return this.Json(chats, JsonRequestBehavior.AllowGet); }
public JsonResult SendChat(string tid,string ctx) { ChatInfo cinfo = new ChatInfo(); if (CurrentUser != null) { cinfo.user_from = CurrentUser.Id.ToString(); cinfo.user_to = tid; cinfo.sendtime = DateTime.Now; cinfo.content = ctx; cinfo.ispublic = true; ChatBLL cbll = new ChatBLL(); cbll.SaveChat(cinfo); } return this.Json("success", JsonRequestBehavior.AllowGet); }