public List <ReadCommentDTO> GetAllComments()
        {
            List <ReadCommentDTO> listDTO;

            using (UnitOfWork uw = new UnitOfWork())
            {
                List <Comment> retList = uw.CommentRepository.GetAll();
                listDTO = ReadCommentDTO.FromEntityList(retList);
            }
            return(listDTO);
        }
Beispiel #2
0
 public ReadComment(ReadCommentDTO dto)
 {
     if (dto != null)
     {
         CommentId = dto.CommentId;
         Text      = dto.Text;
         TimeStamp = dto.TimeStamp;
         //CardId = dto.CardId;
         //ListId = dto.ListId;
         Username = dto.Username;
     }
 }
        public ReadCommentDTO GetCommentById(int id)
        {
            ReadCommentDTO dto;

            using (UnitOfWork uw = new UnitOfWork())
            {
                Comment comment = uw.CommentRepository.GetById(id);
                if (comment == null)
                {
                    return(null);
                }
                dto = new ReadCommentDTO(comment);
            }
            return(dto);
        }