Added event when a text element gets selected
This commit is contained in:
4 files changed
+41
-3
No files matched your search
@@ -7,12 +7,21 @@ namespace Processor;
|
||||
|
||||
public static class TextElementProcessor
|
||||
{
|
||||
// Load all text elements for one particular section:
|
||||
public static async Task<List<TextElement>> GetTextElements(Section section)
|
||||
{
|
||||
await using var db = ProcessorMeta.ServiceProvider.GetRequiredService<DataContext>();
|
||||
return await db.TextElements.Where(n => n.Section == section).OrderBy(n => n.Name).ThenBy(n => n.Id).ToListAsync();
|
||||
}
|
||||
|
||||
// Load one text element by id:
|
||||
public static async Task<TextElement> LoadTextElement(int id)
|
||||
{
|
||||
await using var db = ProcessorMeta.ServiceProvider.GetRequiredService<DataContext>();
|
||||
return await db.TextElements.FirstAsync(n => n.Id == id);
|
||||
}
|
||||
|
||||
// Adds a new text element:
|
||||
public static async Task<ProcessorResult<TextElement>> AddTextElement(string? currentSectionKey, string elementName)
|
||||
{
|
||||
await using var db = ProcessorMeta.ServiceProvider.GetRequiredService<DataContext>();
|
||||
|
||||
Reference in new issue
Block a user