public static TagApiModel FromTag(Tag tag) => new TagApiModel { TagId = tag.TagId, Name = tag.Name, Slug = tag.Slug, Notes = tag.NoteTags.Select(x => NoteApiModel.FromNote(x.Note, false)).ToList() };
public async Task <SaveNoteCommand.Response> HandleSaveNoteCommand(SaveNoteCommand.Request request, CancellationToken cancellationToken, SaveNoteCommand.Response response) { var note = await _context.Notes.FindAsync(response.NoteId); await _hubContext.Clients.All.SendAsync("message", new { Type = "[Note] Saved", Payload = new { note = NoteApiModel.FromNote(note) } }); return(response); }