예제 #1
0
 public MessageCommentViewModel AddComment(int messageId, MessageCommentViewModel comment)
 {
     var cmt = new MessageComment()
     {
         MessageId = messageId,
         SendAt = DateTime.Now,
         Comment = comment.Comment,
         User = _userRepository.GetById(comment.UserId)
     };
     return ConvertToCommentViewModel(_messageCommentRepository.Add(cmt));
 }
예제 #2
0
 public MessageCommentViewModel ConvertToCommentViewModel(MessageComment comment)
 {
     return new MessageCommentViewModel()
     {
         Id = comment.Id,
         Comment = comment.Comment,
         SendAt = comment.SendAt,
         UserName = (comment.User.UserDetail == null) ? comment.User.UserName : comment.User.UserDetail.FirstName + " " + comment.User.UserDetail.LastName,
         UserAva = (comment.User.Role == Role.ClubAdmin || comment.User.Role == Role.SystemAdmin) ? "/Images/ProfilePicture.jpg" : "/api/file/ProfilePicture/" + comment.User.UserDetail.ProfilePicture + "/" + comment.User.Id
     };
 }