Ejemplo n.º 1
0
 /// <summary>
 /// Archives the specified noteid.
 /// </summary>
 /// <param name="userid">The userid.</param>
 /// <param name="noteid">The noteid.</param>
 /// <returns></returns>
 /// <exception cref="Exception"></exception>
 public async Task <bool> Archive(int userid, int noteid, TrashValue archive)
 {
     try
     {
         if (userid != 0 && noteid != 0)
         {
             return(await _notesRepository.Archive(userid, noteid, archive));
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Ejemplo n.º 2
0
        public void Archive(Note note)
        {
            _notesRepository.Save(note.Name, note.Content);

            var newName = _notesRepository.Archive(note.Name);

            NoteMetadata metadata = _notesMetadataService.Get(note.Name);

            metadata.Archived = DateTime.Now;

            _notesMetadataService.Remove(note.Name);
            _notesMetadataService.Add(Globals.ArchivePrefix + "/" + newName, metadata);

            _notesMetadataService.Save();

            Archived?.Invoke(this, new ArchivedNoteEventArgs
            {
                ArchivedNote = note
            });
        }