public JsonResult MakeMessagesSeen(int _messageId) { try { var userId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id; MessageDB.GetInstance().MakeMessagesSeen(_messageId, userId); return(Json("")); } catch (Exception exc) { throw exc; } }
public JsonResult SendMessage(int _lastMessageId, string _text, int _receiverId) { try { var userId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id; var result = MessageDB.GetInstance().SendMessage(_lastMessageId, userId, _text, _receiverId); return(Json(result != null ? result.Id : 0)); } catch (Exception exc) { throw exc; } }
public JsonResult GetUnreadMessageCount() { try { var userId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id; var count = MessageDB.GetInstance().GetUnreadMessageCount(userId); return(Json(count)); } catch (Exception exc) { throw exc; } }
public JsonResult GetMessagesBetweenTwoPeople(int _messageId) { try { var userId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id; var list = _messageId == 0 ? new List <MessageRepo>() : MessageDB.GetInstance().GetMessagesBetweenTwoPeople(_messageId, userId); return(Json(list)); } catch (Exception exc) { throw exc; } }
public JsonResult GetNormalMessages() { try { var userId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id; var list = MessageDB.GetInstance().GetMainMessageList(userId); return(Json(list)); } catch (Exception exc) { throw exc; } }