/// <summary> /// Deletes a single <see cref="NoteComment"/> /// </summary> /// <param name="id"></param> public void Delete(int id) { using (var repo = new NoteCommentRepository()) { repo.Delete(id); } }
/// <summary> /// Saves a single <see cref="NoteComment"/> /// </summary> /// <param name="noteComment"></param> public void Save(NoteComment noteComment) { using (var repo = new NoteCommentRepository()) { repo.AddOrUpdate(noteComment); } }
/// <summary> /// Get a list of <see cref="NoteComment"/> objects based on logtype /// </summary> /// <param name="logType"></param> /// <returns></returns> public IEnumerable <NoteComment> GetAll(string logType) { using (var repo = new NoteCommentRepository()) { return(repo.GetAll(logType)); } }
/// <summary> /// Get a list of <see cref="NoteComment"/> objects of a given note /// </summary> /// <param name="noteId"></param> /// <returns></returns> public IEnumerable <NoteComment> GetByNoteId(int noteId) { using (var repo = new NoteCommentRepository()) { return(repo.GetAllByNote(noteId)); } }
/// <summary> /// Deletes all <see cref="NoteComment"/> objects for a given note /// </summary> /// <param name="noteId"></param> public void DeleteByNoteId(int noteId) { using (var repo = new NoteCommentRepository()) { repo.DeleteByNote(noteId); } }
protected void btnCommentDelete_Click(object sender, EventArgs e) { var repo = new NoteCommentRepository(); if (repo.GetCountBy(BoardId, Id, txtPassword.Text.Replace("--", "")) > 0) { repo.DeleteComment(BoardId, Id, txtPassword.Text.Replace("--", "")); Response.Redirect($"BoardView.aspx?Id={BoardId}&ANum={Request["ANum"]}"); } else { lblError.Text = "암호가 틀립니다. 다시 입력해주세요."; } }
/// <summary> /// Add a new <see cref="NoteComment"/> /// </summary> /// <param name="comment"></param> public void Add(int note, int userId, NoteCommentType type, string description) { using (var repo = new NoteCommentRepository()) { repo.AddOrUpdate(new NoteComment() { LogType = type.ToString(), LogComment = description, Datestamp = DateTime.Now, NoteId = note, UserId = userId }); } }
public BoardCommentControl() { _repository = new NoteCommentRepository(); }