public NOTE[] GetNote() { var db = new Notification_SoftwareEntities(); var notes = db.NOTE.ToArray(); return(notes); }
public NOTE GetNote(int id) { var db = new Notification_SoftwareEntities(); var @note = db.NOTE.Find(id); return(@note); }
public void DeleteNote(int id) { var db = new Notification_SoftwareEntities(); var @note = db.NOTE.Find(id); db.NOTE.Remove(@note); db.SaveChanges(); }
public void UpdateNote(int id, string title, string content) { var db = new Notification_SoftwareEntities(); var oldNote = db.NOTE.Find(id); oldNote.TITLE = title; oldNote.CONTENT = content; db.Entry(oldNote).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); }
public void CreateNote(string title, string content) { var newNote = new NOTE(); newNote.TITLE = title; newNote.CONTENT = content; newNote.DTIME = DateTime.Now; var db = new Notification_SoftwareEntities(); db.NOTE.Add(newNote); db.SaveChanges(); }