Initial commit

This commit is contained in:
Jimmy Engström 2023-02-17 15:28:17 +01:00
parent 2190113c56
commit 3088165398
1765 changed files with 192085 additions and 0 deletions

View file

@ -0,0 +1,15 @@
using Components.Interfaces;
using Data.Models;
namespace BlazorServer.Services;
public class BlazorServerBlogNotificationService : IBlogNotificationService
{
public event Action<BlogPost>? BlogPostChanged;
public Task SendNotification(BlogPost post)
{
BlogPostChanged?.Invoke(post);
return Task.CompletedTask;
}
}

View file

@ -0,0 +1,32 @@
namespace BlazorServer.Services;
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
using Components.Interfaces;
public class BlogProtectedBrowserStorage : IBrowserStorage
{
ProtectedSessionStorage Storage { get; set; }
public BlogProtectedBrowserStorage(ProtectedSessionStorage storage)
{
Storage = storage;
}
public async Task DeleteAsync(string key)
{
await Storage.DeleteAsync(key);
}
public async Task<T?> GetAsync<T>(string key)
{
var value = await Storage.GetAsync<T>(key);
if (value.Success)
{
return value.Value;
}
else
{
return default(T);
}
}
public async Task SetAsync(string key, object value)
{
await Storage.SetAsync(key, value);
}
}