// Remove a category from database public void RemoveToDoCategory(ToDoCategory toDoForRemove) { if (toDoForRemove.Id == DefaultCategory.Id) return; foreach (ToDoNote note in toDoDB.Notes) if (note._categoryId == toDoForRemove.Id) note.Category = DefaultCategory; toDoDB.Categories.DeleteOnSubmit(toDoForRemove); toDoDB.SubmitChanges(); ReLoadData(); }
// Rename a category from database public void RenameCategory(ToDoCategory toDoForRename, string newName) { if (toDoForRename.Id == DefaultCategory.Id) return; toDoForRename.Name = newName; toDoDB.SubmitChanges(); ReLoadData(); }
// Add a category to database public void AddToDoCategory(ToDoCategory newToDoCategory) { toDoDB.Categories.InsertOnSubmit(newToDoCategory); toDoDB.SubmitChanges(); ReLoadData(); }