Esempio n. 1
0
        public bool UpdateNote(Note input)
        {
            DalSmartNote.SmartNoteDal dal = new DalSmartNote.SmartNoteDal();
            bool ret = dal.UpdateNote(input);

            return ret;
        }
Esempio n. 2
0
        public bool InsertNote(Note input)
        {
            var collection = _database.GetCollection<Note>("notes");
            collection.InsertOneAsync(input);

            return true;
        }
Esempio n. 3
0
        public bool InsertNote(Note input)
        {
            DalSmartNote.SmartNoteDal dal = new DalSmartNote.SmartNoteDal();
            bool ret = dal.InsertNote(input);

            return ret;
        }
Esempio n. 4
0
        public bool DeleteNote(Note input)
        {
            var collection = _database.GetCollection<Note>("notes");
            var filter = Builders<Note>.Filter.Eq("Id", input.Id);
            var ret = collection.DeleteOneAsync(filter);

            return true;
        }
Esempio n. 5
0
        public bool InsertNote(Note input)
        {
            using (var db = new SQLiteContext())
            {
                db.Notes.Add(input);
                db.SaveChanges();

                return db.Notes.Where(n => n.Id == input.Id).FirstOrDefault() == null ? false : true;
            }
        }
Esempio n. 6
0
        public bool UpdateNote(Note input)
        {
            var collection = _database.GetCollection<Note>("notes");
            var filter = Builders<Note>.Filter.Eq("Id", input.Id);
            //var update = Builders<Note>.Update.Set("Title", input.Title).Set("Text", input.Text)
            //                                  .Set("ModoficationDate", input.ModoficationDate).Set("Links", input.Links)
            //                                  .Set("CreationDate", input.CreationDate).Set("Author", input.Author)
            //                                  .Set("Attachments", input.Attachments);

            //var ret = collection.UpdateOneAsync(filter, update);

            var ret = collection.ReplaceOneAsync(filter, input);

            return true;
        }
Esempio n. 7
0
        public bool UpdateNote(Note input)
        {
            using (var db = new SQLiteContext())
            {
                foreach (var item in input.Links)
                {
                    db.NoteToNote.Add(item);
                }
                db.Notes.Update(input);
                db.SaveChanges();

                Note note = getNote(input);
                return note.ModoficationDate.Date.Equals(DateTime.Today.Date) ? true : false;
            }
        }
Esempio n. 8
0
 public bool DeleteNote(Note input)
 {
     using(var db = new SQLiteContext())
     {
         Note note = getNote(input);
         if(note != null)
         {
             db.Notes.Remove(note);
             db.SaveChanges();
             // Ha törlés után megtalálom a listában, akkor nem sikerült a törlés.
             return db.Notes.Where(n => n.Id == input.Id).FirstOrDefault() == null ? true : false;
         }
         else
         {
             return false;
         }
     }
 }
Esempio n. 9
0
 private Note getNote(Note input)
 {
     using (var db = new SQLiteContext())
     {
         Note note = db.Notes.Where(n => n.Id == input.Id).FirstOrDefault();
         if(note != null)
         {
             note.Attachments = db.Attachments.Where(a => a.Note.Id == note.Id).ToList();
             return note;
         }
         else
         {
             return null;
         }
     }
 }
Esempio n. 10
0
 public bool UpdateNote(Note input)
 {
     return smartNoteDal.UpdateNote(input);
 }
Esempio n. 11
0
 public bool InsertNote(Note input)
 {
     return smartNoteDal.InsertNote(input);
 }
Esempio n. 12
0
 public bool DeleteNote(Note input)
 {
     return smartNoteDal.DeleteNote(input);
 }