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; }
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; }
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; }
public CommentServiceModel getCommentById(int id) { CommentsRepository repo = new CommentsRepository(entities); Comment comment = repo.GetCommentById(id); return DefectUtil.mapCommentEntityToModel(comment); }
public void deleteCommentById(int id) { CommentsRepository repo = new CommentsRepository(entities); Comment comment = repo.GetCommentById(id); repo.DeleteComment(comment); }
public int insertComment(CommentServiceModel comment) { CommentsRepository repo = new CommentsRepository(entities); Comment model = DefectUtil.unmapCommentEntityToModel(comment); return repo.InsertComment(model); }