You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Connected.Common/Connected.Common.Notes/NoteService.cs

61 lines
1.5 KiB

2 years ago
using System.Collections.Immutable;
using Connected.ServiceModel;
using Connected.ServiceModel.Search;
using Connected.Services;
2 years ago
namespace Connected.Common.Notes;
2 years ago
internal sealed class NoteService : Service, INoteService
{
public NoteService(IContext context) : base(context)
{
}
public async Task Delete(PrimaryKeyArgs<long> args)
{
await Invoke(GetOperation<NoteOps.Delete>(), args);
}
public async Task<long> Insert(InsertNoteArgs args)
{
return await Invoke(GetOperation<NoteOps.Insert>(), args);
}
public async Task<ImmutableList<INote>> Query(NoteArgs args)
{
return await Invoke(GetOperation<NoteOps.Query>(), args);
}
public async Task<ImmutableList<INoteText>> QueryText(QueryNoteTextArgs args)
{
return await Invoke(GetOperation<NoteOps.QueryText>(), args);
}
public async Task<ImmutableList<INoteSearch>> Search(SearchArgs args)
{
return await Invoke(GetOperation<NoteOps.Search>(), args);
}
public async Task<INote?> Select(PrimaryKeyArgs<long> args)
{
return await Invoke(GetOperation<NoteOps.Select>(), args);
}
public async Task<INoteText?> SelectText(SelectNoteTextArgs args)
{
await Invoke(GetOperation<NoteOps.Insert>(), new InsertNoteArgs
{
Entity = "Entity",
PrimaryKey = "10",
Author = 10,
Created = DateTime.UtcNow,
Text = "Note text"
}, "Insert");
return await Invoke(GetOperation<NoteOps.SelectText>(), args);
}
public async Task Update(UpdateNoteArgs args)
{
await Invoke(GetOperation<NoteOps.Update>(), args);
}
}