dotnet-cqrs/Demo/Commands/CreatePersonCommand.cs

34 lines
882 B
C#
Raw Normal View History

2021-02-02 12:19:59 -05:00
using FluentValidation;
using PoweredSoft.CQRS.Abstractions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Demo.Commands
{
public class CreatePersonCommand
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
public class CreatePersonCommandValidator : AbstractValidator<CreatePersonCommand>
{
public CreatePersonCommandValidator()
{
RuleFor(t => t.FirstName).NotEmpty();
RuleFor(t => t.LastName).NotEmpty();
}
}
public class CreatePersonCommandHandler : ICommandHandler<CreatePersonCommand>
{
public Task HandleAsync(CreatePersonCommand command, CancellationToken cancellationToken = default)
{
return Task.CompletedTask;
}
}
}