Exemple #1
0
        // Add a translator history to the database and collections.
        public void AddTranslatorHistory(TranslatorHistory newTranslatorHistory)
        {
            // Add a to-do item to the data context.
            translatorDB.History.InsertOnSubmit(newTranslatorHistory);

            // Save changes to the database.
            translatorDB.SubmitChanges();

            AllTranslatorHistory.Add(newTranslatorHistory);
        }
Exemple #2
0
        // Remove a translator history from the database and collections.
        public void DeleteTranslatorHistory(TranslatorHistory historyForDelete)
        {
            if (historyForDelete.IsFavorite == true)
            {
                // remove from both list boxes
                // Remove the to-do item from the "all" observable collection.
                AllTranslatorHistory.Remove(historyForDelete);
                FavoriteTranslatorHistory.Remove(historyForDelete);
            }
            else
            {
                // only remove from main listbox
                // Remove the to-do item from the "all" observable collection.
                AllTranslatorHistory.Remove(historyForDelete);
            }


            // Remove the to-do item from the data context.
            translatorDB.History.DeleteOnSubmit(historyForDelete);

            // Save changes to the database.
            translatorDB.SubmitChanges();
        }