Fixed methods naming

This commit is contained in:
ruri
2019-12-20 22:13:03 +01:00
parent 5f534a90d8
commit 81a201ebcf
3 changed files with 29 additions and 26 deletions
@@ -31,6 +31,8 @@ namespace OpenBullet.ViewModels
return WordlistsCollection.Where(x => x.Name == name).First();
}
#region CRUD Operations
// Create
public void Add(Wordlist wordlist)
{
if (WordlistsCollection.Any(w => w.Path == wordlist.Path))
@@ -42,12 +44,33 @@ namespace OpenBullet.ViewModels
_repo.Add(wordlist);
}
public void Delete(Wordlist wordlist)
// Read
public void RefreshList()
{
WordlistsCollection = new ObservableCollection<Wordlist>(_repo.Get());
}
// Update
public void Update(Wordlist wordlist)
{
_repo.Update(wordlist);
}
// Delete
public void Remove(Wordlist wordlist)
{
WordlistsCollection.Remove(wordlist);
_repo.Remove(wordlist);
}
public void RemoveAll()
{
WordlistsCollection.Clear();
_repo.RemoveAll();
}
#endregion
#region Delete methods
public void DeleteNotFound()
{
foreach (var wordlist in WordlistsCollection)
@@ -58,26 +81,6 @@ namespace OpenBullet.ViewModels
}
}
}
public void DeleteAll()
{
WordlistsCollection.Clear();
_repo.RemoveAll();
}
public void RefreshList()
{
WordlistsCollection = new ObservableCollection<Wordlist>(_repo.Get());
}
public void Update(Wordlist wordlist)
{
_repo.Update(wordlist);
}
public void Remove(Wordlist wordlist)
{
_repo.Remove(wordlist);
}
#endregion
}
}
@@ -41,7 +41,7 @@ namespace OpenBullet.Views.Main
Globals.LogInfo(Components.WordlistManager, $"Deleting {wordlistListView.SelectedItems.Count} references from the DB");
foreach (var wordlist in wordlistListView.SelectedItems.Cast<Wordlist>().ToList())
{
vm.Delete(wordlist);
vm.Remove(wordlist);
}
Globals.LogInfo(Components.WordlistManager, "Successfully deleted the wordlist references from the DB");
}
@@ -54,7 +54,7 @@ namespace OpenBullet.Views.Main
if (MessageBox.Show("This will purge the WHOLE Wordlists DB, are you sure you want to continue?", "WARNING", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
{
Globals.LogInfo(Components.WordlistManager, "Purge initiated");
vm.DeleteAll();
vm.RemoveAll();
Globals.LogInfo(Components.WordlistManager, "Purge finished");
}
else { Globals.LogInfo(Components.WordlistManager, "Purge dismissed"); }
+2 -2
View File
@@ -41,8 +41,8 @@ namespace RuriLib.Interfaces
void DeleteNotFound();
/// <summary>
/// Deletes all wordlists from the collection.
/// Removes all wordlists from the collection.
/// </summary>
void DeleteAll();
void RemoveAll();
}
}