예제 #1
0
 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;
     }
 }
예제 #2
0
 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;
     }
 }
예제 #3
0
        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;
            }
        }
예제 #4
0
        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;
            }
        }
예제 #5
0
        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;
            }
        }