示例#1
0
        public IEnumerable<CommentServiceModel> getCommentsByKeyword(string text)
        {
            CommentsRepository repo = new CommentsRepository(entities);
            List<CommentServiceModel> models = new List<CommentServiceModel>();
            IEnumerable<Comment> comments = repo.FindCommentsByKeyword(text);

            foreach (Comment comment in comments) {
                models.Add(DefectUtil.mapCommentEntityToModel(comment));
            }

            return models;
        }
示例#2
0
        public IEnumerable<CommentServiceModel> getCommentsBeforeDate(DateTime dateTimeStamp)
        {
            CommentsRepository repo = new CommentsRepository(entities);
            List<CommentServiceModel> models = new List<CommentServiceModel>();
            IEnumerable<Comment> comments = repo.FindAllCommentsBeforeDate(dateTimeStamp);

            foreach (Comment comment in comments) {
                models.Add(DefectUtil.mapCommentEntityToModel(comment));
            }

            return models;
        }
示例#3
0
        public IEnumerable<CommentServiceModel> getCommentsByUser(int id)
        {
            CommentsRepository repo = new CommentsRepository(entities);
            List<CommentServiceModel> models = new List<CommentServiceModel>();
            IEnumerable<Comment> comments = repo.FindAllCommentsForDefect(id);

            foreach (Comment comment in comments) {
                models.Add(DefectUtil.mapCommentEntityToModel(comment));
            }

            return models;
        }
示例#4
0
 public CommentServiceModel getCommentById(int id)
 {
     CommentsRepository repo = new CommentsRepository(entities);
     Comment comment = repo.GetCommentById(id);
     return DefectUtil.mapCommentEntityToModel(comment);
 }
示例#5
0
 public void deleteCommentById(int id)
 {
     CommentsRepository repo = new CommentsRepository(entities);
     Comment comment = repo.GetCommentById(id);
     repo.DeleteComment(comment);
 }
示例#6
0
 public int insertComment(CommentServiceModel comment)
 {
     CommentsRepository repo = new CommentsRepository(entities);
     Comment model = DefectUtil.unmapCommentEntityToModel(comment);
     return repo.InsertComment(model);
 }