예제 #1
0
        public string GetNotifications(int id) // senderId
        {
            var messageNotificationListViewModel = new MessageNotificationListModel(MemberSession.GetMemberId());

            if (messageNotificationListViewModel.Notifications == null ||
                messageNotificationListViewModel.OrderedMessages.Count == 0)
            {
                return(false.ToString());
            }

            messageNotificationListViewModel.CheckNotifications(MemberSession.GetMemberId());

            var messageList = new MessageListModel
            {
                OrderedMessages = messageNotificationListViewModel.OrderedMessages
            };
            var jsonSerialiser = new JavaScriptSerializer();
            var json           = jsonSerialiser.Serialize(messageList);

            // obrisati sve notifikacje od tog Sendera, namenjene receiveru
            var messageNotification = new MessageNotification();

            messageNotification.DeleteAllFrom(id, MemberSession.GetMemberId());

            return(json); // vraca listu nedodatih poruka
        }
예제 #2
0
        public string Conversation(int id) // receiverId
        {
            var messageList = new MessageListModel(id);

            var jsonSerialiser = new JavaScriptSerializer();
            var json           = jsonSerialiser.Serialize(messageList);

            // TODO: postavi da se sve notifikacije obrisu koje su bile za tog usera
            var messageNotification = new MessageNotification();

            messageNotification.DeleteAllFrom(id, MemberSession.GetMemberId());
            return(json);
        }