Implemented the culture delete function
This commit is contained in:
7 files changed
+94
No files matched your search
@@ -385,6 +385,29 @@ public static class AppSettings
|
||||
|
||||
#endregion
|
||||
|
||||
#region Delete a culture
|
||||
|
||||
public static async Task DeleteCulture(int index)
|
||||
{
|
||||
// Get the database:
|
||||
await using var db = ProcessorMeta.ServiceProvider.GetRequiredService<DataContext>();
|
||||
|
||||
// Check, if the setting is already set:
|
||||
if (await db.Settings.FirstOrDefaultAsync(n => n.Code.StartsWith(SettingNames.CULTURE) && n.IntegerValue == index) is {} existingSetting)
|
||||
{
|
||||
db.Settings.Remove(existingSetting);
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
|
||||
// Update the list of cultures indices:
|
||||
CACHE_CULTURES_INDICES.Remove(index);
|
||||
|
||||
// Update the cache:
|
||||
CACHE_CULTURES.Remove(index);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Get a list of cultures
|
||||
|
||||
public readonly record struct CultureInfo(string Code, int Index);
|
||||
|
||||
Reference in new issue
Block a user