// GET api/<controller>/5 deleting trash public bool Post([FromBody] ConversationIDs ConIDObj) { try { int m_UserID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); bool m_res = false; foreach (string Con_id in ConIDObj.ConIDs) { if (Regex.IsMatch(Con_id, @"^\d+$")) { int ConversationID = Convert.ToInt32(Con_id); m_res = new Conversation().TrashConversation(ConversationID, m_UserID); } else { //trash chat conversation m_res = new IMConversation().TrashIMConversation(Con_id, m_UserID); } } return(m_res); } catch (Exception) { return(false); } }
// POST api/<controller> public IEnumerable <IMConversation> Post([FromBody] GetIMClass GetIM) { int _UserID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); IMConversation[] m_IMConversations = new IMConversation().GetIMConversation(_UserID, GetIM.OtherUserID); return(m_IMConversations); }
public bool Post([FromBody] ChatMessage _DelObj) { int _UserID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); bool _res = new IMConversation().DeleteIMConversation(_DelObj.IM_id, _UserID); return(_res); }
// POST api/<controller> public IMConversation Post([FromBody] PostIMClass PostIM) { int _UserID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); IMConversation m_IMConversation = new IMConversation().SendMessage(_UserID, PostIM.OtherUserID, PostIM.MessageText); return(m_IMConversation); }
public void sendMessage(string RecipientID, IMConversation m_IMConversation) { string _ConnectionID = new OnlineUsers().GetUserConnectionID(Convert.ToInt32(RecipientID)); if (_ConnectionID != "") { int _SenderUserID = new OnlineUsers().GetUserID(Context.ConnectionId); Clients.Client(_ConnectionID).sendmessage(_SenderUserID, m_IMConversation); } }
public bool Post([FromBody] IMCMessage _DelObj) { int _UserID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); var _GetIMC = new IMConversation().GetIMConversationDateWise(_UserID, _DelObj.OtherUserID, _DelObj.SentDate); bool _res = false; foreach (var IMChat in _GetIMC) { _res = new IMConversation().DeleteIMConversation(IMChat._id, _UserID); } return(_res); }
public bool Post([FromBody] ChatMessage _DelObj) { try { int _UserID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); bool _res = new IMConversation().TrashIMConversation(_DelObj.IM_id, _UserID); return(_res); } catch (Exception) { return(false); } }
// GET api/<controller>/5 delete IM public bool Get(int id) { int _UserID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); int m_OtherUserID = id; bool m_Res = false; IMConversation[] m_IMConversations = new IMConversation().GetIMConversation(_UserID, m_OtherUserID); foreach (var item in m_IMConversations) { m_Res = new IMConversation().DeleteIMConversation(item._id); } return(m_Res); }
public IEnumerable <IMConversation> Post([FromBody] GetIMClass GetIM) { try { int _UserID = Convert.ToInt32(HttpContext.Current.User.Identity.Name); IMConversation[] m_IMConversations = new IMConversation().GetIMConversation(_UserID, GetIM.OtherUserID); return(m_IMConversations.Reverse().Take(10).OrderBy(x => x.SentTime)); } catch (Exception) { return(null); } }