Example #1
0
 public MessageDTO(Message message)
 {
     Id         = message.Id;
     Text       = message.Text;
     Sender     = new UserInfoSmallDTO(message.Sender);
     DateSended = message.DateSended;
 }
Example #2
0
 public CommentDTO(Comment comment)
 {
     Id          = comment.Id;
     User        = new UserInfoSmallDTO(comment.User);
     Text        = comment.Text;
     CommentDate = comment.CommentDate;
 }
Example #3
0
 public AdDTO(Ad ad)
 {
     Id          = ad.Id.ToString();
     Title       = ad.Title;
     Description = ad.Description;
     Company     = ad.Company;
     Owner       = new UserInfoSmallDTO(ad.Owner);
     Applicants  = UserInfoSmallDTO.ToUserInfoSmallDTOList(ad.UserAds?.Select(x => x.User));
 }
Example #4
0
 public PostDTO(Post post)
 {
     Id          = post.Id;
     Title       = post.Title;
     FileName    = post.FileName;
     User        = new UserInfoSmallDTO(post.Owner);
     Subscribers = UserInfoSmallDTO.ToUserInfoSmallDTOList(post.UserPosts?.Select(x => x.User));
     Comments    = CommentDTO.ToCommentDTOList(post.Comments);
     Type        = post.Type;
     PostedDate  = post.PostedDate;
     Description = post.Description;
 }
Example #5
0
 public ConversationDTO(Conversation conversation, User user)
 {
     Id              = conversation.Id;
     ToUser          = new UserInfoSmallDTO(conversation.ToUser == user ? conversation.FromUser : conversation.ToUser);
     HasNewMessagees = conversation.ToUser == user ? conversation.FromUserHasNewMessages : conversation.ToUserHasNewMessages;
 }