23 lines
550 B
C#
23 lines
550 B
C#
using BookHive.DTO.Author;
|
|
using FastEndpoints;
|
|
using FluentValidation;
|
|
|
|
namespace BookHive.Validators.Authors;
|
|
|
|
public class GetAuthorDtoValidator : Validator<GetAuthorDto>
|
|
{
|
|
public GetAuthorDtoValidator()
|
|
{
|
|
RuleFor(x => x.Id)
|
|
.GreaterThan(0)
|
|
.WithMessage("Id is invalid");
|
|
|
|
RuleFor(x => x.FirstName)
|
|
.NotEmpty()
|
|
.WithMessage("First name is required");
|
|
|
|
RuleFor(x => x.LastName)
|
|
.NotEmpty()
|
|
.WithMessage("Last name is required");
|
|
}
|
|
} |