EntitySave
When to Use
Sample API Implementation
using Bloqs.App.Engine.Commands;
using Bloqs.App.Engine.Commands.Data;
using Templates.SampleApp.Models.Data;
namespace Templates.SampleApp.Api.Commands.Activities;
[EntityCommandHandler<Activity>]
public class ActivitySave
: ICommandHandler<EntitySaveCommand, EntitySaveCommandResult>
{
public Task<EntitySaveCommandResult> HandleAsync(
EntitySaveCommand command,
CancellationToken cancellationToken = default
)
{
var activity = (Activity)command.DataEntities.First();
Console.WriteLine($"{AppConstants.App.Name} [API]: Saving activity: " + activity.Name);
// custom save logic here
// e.g., update via data service, external API, etc.
return Task.FromResult(EntitySaveCommandResult.CreateSuccess(activity));
}
}Sample UI Implementation (Blazor WASM)
Notes
Last updated