예제 #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);
 }