// 回收站 // 可以移到noteSerice中 // 不能删除notebook, 如果其下有notes! // 这样回收站里只有note // 删除笔记后(或删除笔记本)后入回收站 // 把note, notebook设个标记即可! // 已经在trash里的notebook, note不能是共享!, 所以要删除共享 // 删除note // 应该放在回收站里 // 有trashService public bool DeleteNote(long?noteId, long?userId) { var note = noteService.GetNote(noteId, userId); if (note.IsTrash) { return(this.DeleteTrash(noteId, userId)); } return(noteService.SetDeleteStatus(noteId, userId)); //todo:支持共享笔记删除 }
//todo 删除废纸篓 public static bool DeleteTrashApi(long noteId, long userId, int usn, out string msg, out int afterUsn) { Note note = NoteService.GetNote(noteId, userId); if (note == null) { msg = "notExists"; afterUsn = 0; //todo: 存疑 return(false); } if (note.Usn != usn) { msg = "conflict"; afterUsn = 0; return(false); } // 设置删除位 //afterUsn = UserService.IncrUsn(userId); // delete note's attachs var result = NoteService.SetDeleteStatus(noteId, userId, out afterUsn); if (!result) { msg = "设置删除位错误"; afterUsn = 0; return(false); } AttachService.DeleteAllAttachs(noteId, userId); // 删除content history NoteContentService.DeleteByIdAndUserId(noteId, userId, true); NotebookService.ReCountNotebookNumberNotes(note.NotebookId); msg = ""; return(true); }