Implementing the NewEntity Command
How to Implement
Sample Code
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 NewActivity : ICommandHandler<NewEntityCommand, NewEntityCommandResult>
{
public Task<NewEntityCommandResult> HandleAsync(
NewEntityCommand command,
CancellationToken cancellationToken = default
)
{
var newActivity = new Activity()
{
Name = "New Activity",
Description = "New Activity Description",
};
return Task.FromResult(NewEntityCommandResult.CreateSuccess(newActivity));
}
}Key Points
Last updated