feat(Database) Adding entity dialog

This commit is contained in:
2022-04-01 17:35:10 -04:00
parent c4f1b86f27
commit a9d3920237
36 changed files with 429 additions and 150 deletions
-3
View File
@@ -1,3 +0,0 @@
namespace Services.Website;
public class DialogService { }
+49
View File
@@ -0,0 +1,49 @@
using Model.Immortal.Entity;
namespace Services.Website;
public class EntityDialogService : IEntityDialogService
{
private string? entityId = null;
private event Action _onChange;
private void NotifyDataChanged() {
_onChange?.Invoke();
}
public void Subscribe(Action action) {
_onChange += action;
}
public void Unsubscribe(Action action) {
_onChange += action;
}
public void AddDialog(string id)
{
entityId = id;
NotifyDataChanged();
}
public void CloseDialog()
{
entityId = null;
NotifyDataChanged();
}
public bool HasDialog()
{
return entityId != null;
}
public string? GetEntityId()
{
return entityId;
}
}
+8 -2
View File
@@ -1,6 +1,10 @@
using System.Net.Http.Json;
#if !NO_SQL
using Contexts;
using Microsoft.EntityFrameworkCore;
#endif
using Model.Website;
namespace Services.Work;
@@ -10,6 +14,10 @@ public class WebsiteService : IWebsiteService {
private bool isLoaded;
private event Action _onChange;
public WebsiteService(HttpClient httpClient) {
this.httpClient = httpClient;
}
@@ -76,8 +84,6 @@ public class WebsiteService : IWebsiteService {
NotifyDataChanged();
}
private event Action _onChange;
private void NotifyDataChanged() {
_onChange?.Invoke();
}