23 lines
517 B
C#
23 lines
517 B
C#
using BinaryDad.Notes.Services;
|
|
using Microsoft.AspNetCore.SignalR;
|
|
|
|
namespace BinaryDad.Notes
|
|
{
|
|
public class NoteHub : Hub
|
|
{
|
|
private readonly INoteService noteService;
|
|
|
|
public NoteHub(INoteService noteService)
|
|
{
|
|
this.noteService = noteService;
|
|
}
|
|
|
|
public async Task SaveNote(string content, string? noteName)
|
|
{
|
|
noteService.Save(content, noteName);
|
|
|
|
await Clients.Others.SendAsync("updateNote", content);
|
|
}
|
|
}
|
|
}
|