public bool Save(Notes note) { try { using (DataBaseContext db = new DataBaseContext(DataBaseContext.ConnectionString)) { db.Notes.InsertOnSubmit(note); db.SubmitChanges(); } return true; } catch (Exception) { return false; } }
public bool Save(Notes note) { try { using (DataBaseContext db = new DataBaseContext(DataBaseContext.ConnectionString)) { db.Notes.InsertOnSubmit(note); db.SubmitChanges(); } return(true); } catch (Exception) { return(false); } }
public bool DestroyOldNotes(int days) { try { using (DataBaseContext db = new DataBaseContext(DataBaseContext.ConnectionString)) { var destroy = db.Notes.Where(t => t.date < DateTime.Now.AddDays(-days)).ToList(); db.Notes.DeleteAllOnSubmit(destroy); db.SubmitChanges(); return true; } } catch (Exception) { return false; } }
public bool Destroy(Notes note) { try { using (DataBaseContext db = new DataBaseContext(DataBaseContext.ConnectionString)) { var excluir = db.Notes.Where(t => t.id == note.id).First(); db.Notes.DeleteOnSubmit(excluir); db.SubmitChanges(); } return true; } catch (Exception) { return false; } }
public bool Destroy(Notes note) { try { using (DataBaseContext db = new DataBaseContext(DataBaseContext.ConnectionString)) { var excluir = db.Notes.Where(t => t.id == note.id).First(); db.Notes.DeleteOnSubmit(excluir); db.SubmitChanges(); } return(true); } catch (Exception) { return(false); } }
public bool DestroyOldNotes(int days) { try { using (DataBaseContext db = new DataBaseContext(DataBaseContext.ConnectionString)) { var destroy = db.Notes.Where(t => t.date < DateTime.Now.AddDays(-days)).ToList(); db.Notes.DeleteAllOnSubmit(destroy); db.SubmitChanges(); return(true); } } catch (Exception) { return(false); } }
//ToDo Update note using Linq internal bool UpdateNote(int id, string note) { try { using (DataBaseContext db = new DataBaseContext(DataBaseContext.ConnectionString)) { Notes update = (from tar in db.Notes where tar.id == id select tar).First(); update.note = note; db.SubmitChanges(); } return(true); } catch (Exception) { return(false); } }
//ToDo Update note using Linq internal bool UpdateNote(int id, string note) { try { using (DataBaseContext db = new DataBaseContext(DataBaseContext.ConnectionString)) { Notes update = (from tar in db.Notes where tar.id == id select tar).First(); update.note = note; db.SubmitChanges(); } return true; } catch (Exception) { return false; } }