Ejemplo n.º 1
0
        public UserComment addComment(int messageId, string userId, string commentText)
        {
            UserComment userComment = new UserComment();

            userComment.messageId   = messageId;
            userComment.commentText = commentText;
            userComment.commeterId  = userId;
            using (var entDb = new EntityDbContext())
            {
                entDb.UserComments.Add(userComment);
                entDb.SaveChanges();
            }
            return(userComment);
        }
Ejemplo n.º 2
0
        public UserMessage addMessage(string userId, string messageText)
        {
            UserMessage newMessage = new UserMessage();

            newMessage.messageText = messageText;
            newMessage.posterId    = userId;
            newMessage.postedDate  = DateTime.Now;


            using (var entDB = new EntityDbContext())
            {
                entDB.UserMessages.Add(newMessage);
                entDB.SaveChanges();
            }

            return(newMessage);
        }