internal static List<CommentDto> GetList(List<Comment> list, List<Comment> source)
        {
            var dtoList = new List<CommentDto>();

            foreach (var i in list)
            {
                var item = new CommentDto
                {
                    ID = i.CommentID,
                    Comment = i.Comment1,
                    Date = i.Date,
                    Parent = i.ReplyCommentID == null ? null : new CommentDto { ID = i.ReplyCommentID.Value },
                    Place = i.Place.ToEntity<PlaceDto>(),
                    User = i.User.ToEntity<UserDto>(),
                };

                item.Replys = CommentBusiness.GetList(source.Where(l => l.ReplyCommentID == i.CommentID).ToList(), source.Where(l => l.ReplyCommentID != i.CommentID).ToList());
                dtoList.Add(item);
            }

            return dtoList;
        }
Example #2
0
        private List<CommentDto> getCommentDto( List<OpenComment> moreList )
        {
            List<CommentDto> list = new List<CommentDto>();
            foreach (OpenComment c in moreList) {

                Dictionary<String, String> userInfo = getUserInfo( c.Member, c.Author );

                CommentDto dto = new CommentDto();
                dto.Id = c.Id;
                dto.UserName = userInfo["userName"];
                dto.UserFace = userInfo["userFace"];
                dto.AuthorText = userInfo["authorText"];
                dto.Content = c.Content;
                dto.Created = c.Created.ToString( "g" );

                list.Add( dto );
            }

            return list;
        }
Example #3
0
 public virtual void Create(CommentDto item)
 {
     this.unitOfWork.Entities<Comment, long>().Create(Mapper.Map<Comment>(item));
 }