public static void addTrash(Trash trash) { using (var _context = new SimpleNoteEntities()) { _context.Trashes.Add(trash); _context.SaveChanges(); } }
public static List <Tag> LoadTag() { using (var _context = new SimpleNoteEntities()) { var tag = (from u in _context.Tags select u).ToList(); return(tag); } }
public static List <User_Note> LoadNoteofUser(string username) { using (var _context = new SimpleNoteEntities()) { var note = (from u in _context.User_Note where u.Username == username select u).ToList(); return(note); } }
public static Note_Backup LoadNote_Backup(int ID) { using (var _context = new SimpleNoteEntities()) { var note_backup = (from u in _context.Note_Backup where u.ID == ID select u).SingleOrDefault(); return(note_backup); } }
public static Trash GetTrash(int id) { using (var _context = new SimpleNoteEntities()) { var t = (from tr in _context.Trashes where tr.TrashID == id select tr).SingleOrDefault(); return(t); } }
public static List <Note_Tag> LoadNoteofTag(string tag) { using (var _context = new SimpleNoteEntities()) { var note = (from u in _context.Note_Tag where u.MiniTag == tag select u).ToList(); return(note); } }
public static List <Note_Tag> GetTag(int ID) { using (var _context = new SimpleNoteEntities()) { var note_tag = (from u in _context.Note_Tag where u.ID == ID select u).ToList(); return(note_tag); } }
public static Note getNote(int id) { using (var _context = new SimpleNoteEntities()) { var note = (from n in _context.Notes where n.NoteID == id select n).SingleOrDefault(); return(note); } }
//public static Note GetNote(string Header) //{ // using (var _context = new SimpleNoteEntities()) // { // var note = (from u in _context.Notes // where u.Header == Header // select u).FirstOrDefault(); // return note; // } //} public static Note GetNote(int ID) { using (var _context = new SimpleNoteEntities()) { var note = (from u in _context.Notes where u.ID == ID select u).FirstOrDefault(); return(note); } }
public static List <User_Note_Backup> LoadNoteofUser_Backup(string username) { using (var _context = new SimpleNoteEntities()) { var user_note_backup = (from u in _context.User_Note_Backup where u.Username == username select u).ToList(); return(user_note_backup); } }
public static void deleteTrash(int id) { using (var _context = new SimpleNoteEntities()) { var tr = (from t in _context.Trashes where t.TrashID == id select t).Single(); _context.Trashes.Remove(tr); _context.SaveChanges(); } }
public static List <int> getListNoteID() { using (var _context = new SimpleNoteEntities()) { var note = (from u in _context.Notes.AsEnumerable() select u.ID).ToList(); if (note.Count <= 0) { return(null); } return(note); } }
public static List <Note_Tag> getListNote_searchTag(string tag) { using (var _context = new SimpleNoteEntities()) { var note_tag = (from u in _context.Note_Tag.AsEnumerable() where u.MiniTag.Contains(tag) select new Note_Tag { ID = u.ID, MiniTag = u.MiniTag }).ToList(); return(note_tag); } }
public static bool AddUser(User user) { try { using (var _context = new SimpleNoteEntities()) { _context.Users.Add(user); _context.SaveChanges(); return(true); } } catch { return(false); } }
public static bool AddTag(Tag tag) { try { using (var _context = new SimpleNoteEntities()) { _context.Tags.Add(tag); _context.SaveChanges(); return(true); } } catch { return(false); } }
public static bool UpdateUser_Note(User_Note user_note) { try { using (var _context = new SimpleNoteEntities()) { _context.User_Note.AddOrUpdate(user_note); _context.SaveChanges(); return(true); } } catch { return(false); } }
public static bool addNote(Note note) { try { using (var _context = new SimpleNoteEntities()) { _context.Notes.AddOrUpdate(note); _context.SaveChanges(); return(true); } } catch { return(false); } }
public static bool AddNote_Backup(Note_Backup note_backup) { try { using (var _context = new SimpleNoteEntities()) { _context.Note_Backup.Add(note_backup); _context.SaveChanges(); return(true); } } catch { return(false); } }
public static bool AddNote_Tag(Note_Tag note_tag) { try { using (var _context = new SimpleNoteEntities()) { _context.Note_Tag.Add(note_tag); _context.SaveChanges(); return(true); } } catch { return(false); } }
public static List <Note> getListNote_searchHeader(string header) { using (var _context = new SimpleNoteEntities()) { var note = (from u in _context.Notes.AsEnumerable() where u.Header.Contains(header) select new Note { ID = u.ID, Context = u.Context, Header = u.Header, Time = u.Time, TimeEdit = u.TimeEdit, }).ToList(); return(note); } }
public static User getUser(string username) { using (var _context = new SimpleNoteEntities()) { var user = (from u in _context.Users where u.Username == username select u).ToList(); if (user.Count == 1) { return(user[0]); } else { return(null); } } }
public static bool checkPassword(string username, string password) { using (var _context = new SimpleNoteEntities()) { var user = (from u in _context.Users where u.Username == username && u.Password == password select u).SingleOrDefault(); if (user is null) { return(false); } else { return(true); } } }
public static List <Trash> getListTrash(string str) { using (var _context = new SimpleNoteEntities()) { var t = (from n in _context.Trashes.AsEnumerable() where n.TrashTitle.Contains(str) select new { title = n.TrashTitle, descreption = n.TrashDescription }).Select(x => new Trash { TrashDescription = x.descreption, TrashTitle = x.title }).ToList(); return(t); } }
public static bool checkUser_Note(User_Note user_note) { using (var _context = new SimpleNoteEntities()) { var user_notes = (from u in _context.User_Note where u.ID == user_note.ID where u.Username == user_note.Username select u).SingleOrDefault(); if (user_notes != null) { return(true); } else { return(false); } } }
public static bool deleteNote(int id) { try { using (var _context = new SimpleNoteEntities()) { var note = (from n in _context.Notes where n.NoteID == id select n).Single(); _context.Notes.Remove(note); _context.SaveChanges(); return(true); } } catch { return(false); } }
public static int getIDNotes() { using (var _context = new SimpleNoteEntities()) { var note = (from u in _context.Notes.AsEnumerable() select new Note { ID = u.ID, Header = u.Header, Context = u.Context, Time = u.Time, }).ToList(); if (note.Count <= 0) { return(0); } return(note[note.Count - 1].ID); } }
public static bool DeleteTag(Tag tag) { //try //{ using (var _context = new SimpleNoteEntities()) { var tags = (from u in _context.Tags where u.Tag1 == tag.Tag1 select u).SingleOrDefault(); _context.Tags.Remove(tags); _context.SaveChanges(); return(true); } //} //catch //{ // return false; //} }
public static bool DeleteNote_Backup(Note_Backup note_backup) { try { using (var _context = new SimpleNoteEntities()) { var notes = (from u in _context.Note_Backup where u.ID == note_backup.ID select u).SingleOrDefault(); _context.Note_Backup.Remove(notes); _context.SaveChanges(); return(true); } } catch { return(false); } }
public static bool DeleteNote_Tag(Note_Tag note_tag) { try { using (var _context = new SimpleNoteEntities()) { var note = (from u in _context.Note_Tag where u.ID == note_tag.ID where u.MiniTag == note_tag.MiniTag select u).SingleOrDefault(); _context.Note_Tag.Remove(note); _context.SaveChanges(); return(true); } } catch { return(false); } }
public static bool DeleteUser_Note(User_Note user_note) { try { using (var _context = new SimpleNoteEntities()) { var user_notes = (from u in _context.User_Note where u.ID == user_note.ID where u.Username == user_note.Username select u).SingleOrDefault(); _context.User_Note.Remove(user_notes); _context.SaveChanges(); return(true); } } catch { return(false); } }