public bool UpdateNote(Note input) { DalSmartNote.SmartNoteDal dal = new DalSmartNote.SmartNoteDal(); bool ret = dal.UpdateNote(input); return ret; }
public bool InsertNote(Note input) { var collection = _database.GetCollection<Note>("notes"); collection.InsertOneAsync(input); return true; }
public bool InsertNote(Note input) { DalSmartNote.SmartNoteDal dal = new DalSmartNote.SmartNoteDal(); bool ret = dal.InsertNote(input); return ret; }
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; }
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; } }
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; }
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; } }
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; } } }
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; } } }
public bool UpdateNote(Note input) { return smartNoteDal.UpdateNote(input); }
public bool InsertNote(Note input) { return smartNoteDal.InsertNote(input); }
public bool DeleteNote(Note input) { return smartNoteDal.DeleteNote(input); }