Пример #1
0
        public void Delete(long id)
        {
            using (var db = new NoteContext(_connectionString))
            {
                var noteToDelete = db.Notes.First(note => note.Id == id);

                db.Notes.DeleteOnSubmit(noteToDelete);
                db.SubmitChanges();
            }
        }
Пример #2
0
 public void Add(string title, string contents)
 {
     using (var db = new NoteContext(_connectionString))
     {
         db.Notes.InsertOnSubmit(
             new Note
         {
             Title    = title,
             Contents = contents
         });
         db.SubmitChanges();
     }
 }