feat(Database) Adding entity dialog
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
namespace Services.Website;
|
||||
|
||||
public class DialogService { }
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user