Exemplo n.º 1
0
        public void AddComment(string comment, int discussionId)
        {
            var user = _db.Users.Find(UserSession.CurrentUserId);
            var msg = new DiscussionComment
            {
                SenderId = user.UserId,
                SenderName = user.FullName,
                Text = comment,
                Date = DateTime.UtcNow,
                DiscussionId = discussionId,
            };

            _db.DiscussionComments.Add(msg);
            _db.SaveChanges();
        }
Exemplo n.º 2
0
 private DiscussionComment CreateComment(string message)
 {
     var user = _db.Users.Find(UserSession.CurrentUserId);
     var comment = new DiscussionComment
     {
         Date = DateTime.UtcNow,
         Text = message,
         SenderId = user.UserId,
         SenderName = user.FullName,
     };
     return comment;
 }