public void Add(Note note) { //Notes.Add(note); NoteDataContext.Current.Notes.InsertOnSubmit(note); NoteDataContext.Current.SubmitChanges(); }
public void Update(Note note) { //var result = Notes.Single(x => x.Id == note.Id); //result.Content = note.Content; //result.Title = note.Title; var updatedNote = (from c in NoteDataContext.Current.Notes where c.Id == note.Id select c).First(); updatedNote.Title = note.Title; updatedNote.Content = note.Content; NoteDataContext.Current.SubmitChanges(); }
public void Delete(Note note) { NoteDataContext.Current.Notes.DeleteOnSubmit(note); NoteDataContext.Current.SubmitChanges(); }
public static void SeedDB() { var rebekaR = new User() { UserName = "******", Password = "******", IsAdmin = true }; var adnanR = new User() { UserName = "******", Password = "******", IsAdmin = false }; var attilaR = new User() { UserName = "******", Password = "******", IsAdmin = false }; UserList.Add(rebekaR); UserList.Add(adnanR); UserList.Add(attilaR); //Adding some Test messages var msg1 = new Note() { MsgText = "This is a Test MSG", PostDate = DateTime.Now, User = "******" }; var msg2 = new Note() { MsgText = "This is a Test MSG", PostDate = DateTime.Now, User = "******" }; NoteList.Add(msg1); NoteList.Add(msg2); var red = new CalendarColor() { Primary = "#ad2121", Secondary = "#FAE3E3" }; var blue = new CalendarColor() { Primary = "#1e90ff", Secondary = "#D1E8FF" }; var yellow = new CalendarColor() { Primary = "#e3bc08", Secondary = "#FDF1BA" }; var event1 = new CalendarEvent() { ID = id++, title = "Adnan", color = yellow, start = "2018-12-15" }; // primary: '#ad2121', //secondary: '#FAE3E3' var event2 = new CalendarEvent() { ID = id++, title = "Rebeka", color = red, start = "2018-12-16" }; var event3 = new CalendarEvent() { ID = id++, title = "Adnan", color = blue, start = "2018-12-17" }; CalendarEventList.Add(event1); CalendarEventList.Add(event2); CalendarEventList.Add(event3); }