|
@@ -56,7 +56,10 @@ namespace InABox.DynamicGrid
|
|
|
/// </remarks>
|
|
|
/// <param name="filename">The filename of the document.</param>
|
|
|
/// <returns>The document with the right filename, or <see langword="null"/> if not found.</returns>
|
|
|
- Document? FindDocument(string filename);
|
|
|
+ Document? FindDocument(string filename)
|
|
|
+ {
|
|
|
+ return new Client<Document>().Load(new Filter<Document>(x => x.FileName).IsEqualTo(filename)).FirstOrDefault();
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// Get a document for a given ID.
|
|
@@ -66,7 +69,10 @@ namespace InABox.DynamicGrid
|
|
|
/// </remarks>
|
|
|
/// <param name="id">The ID of the document.</param>
|
|
|
/// <returns>The document, or <see langword="null"/> if not found.</returns>
|
|
|
- Document? GetDocument(Guid id);
|
|
|
+ Document? GetDocument(Guid id)
|
|
|
+ {
|
|
|
+ return new Client<Document>().Load(new Filter<Document>(x => x.ID).IsEqualTo(id)).FirstOrDefault();
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// Saves a document.
|
|
@@ -75,7 +81,10 @@ namespace InABox.DynamicGrid
|
|
|
/// The usual implementation will go through the <see cref="Client{TEntity}"/> interface.
|
|
|
/// </remarks>
|
|
|
/// <param name="document">The document to save.</param>
|
|
|
- void SaveDocument(Document document);
|
|
|
+ void SaveDocument(Document document)
|
|
|
+ {
|
|
|
+ new Client<Document>().Save(document, "Updated by Editor");
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// Returns a list of the currently edited items; may be an empty array.
|
|
@@ -105,24 +114,6 @@ namespace InABox.DynamicGrid
|
|
|
|
|
|
public virtual IFilter? DefineFilter(Type type) => LookupFactory.DefineFilter(Items ?? Enumerable.Empty<object?>(), type);
|
|
|
|
|
|
- public Document? FindDocument(string filename)
|
|
|
- {
|
|
|
- return new Client<Document>().Load(new Filter<Document>(x => x.FileName).IsEqualTo(filename)).FirstOrDefault();
|
|
|
- }
|
|
|
-
|
|
|
- public Document? GetDocument(Guid id)
|
|
|
- {
|
|
|
- Document? doc = null;
|
|
|
- if (id != Guid.Empty)
|
|
|
- doc = new Client<Document>().Load(new Filter<Document>(x => x.ID).IsEqualTo(id)).FirstOrDefault();
|
|
|
- return doc;
|
|
|
- }
|
|
|
-
|
|
|
- public void SaveDocument(Document document)
|
|
|
- {
|
|
|
- new Client<Document>().Save(document, "");
|
|
|
- }
|
|
|
-
|
|
|
public BaseEditor? GetEditor(DynamicGridColumn column) => column.Editor.CloneEditor();
|
|
|
|
|
|
public object?[] GetItems() => Items ?? Array.Empty<object?>();
|