File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
src/Dotnet.Samples.AspNetCore.WebApi/Validators Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 44
55namespace Dotnet . Samples . AspNetCore . WebApi . Validators ;
66
7+ /// <summary>
8+ /// Validator for PlayerRequestModel.
9+ /// This class uses FluentValidation to define validation rules for the
10+ /// PlayerRequestModel.
11+ /// </summary>
12+ /// <remarks>
13+ /// This class is part of the FluentValidation library, which provides a fluent
14+ /// interface for building validation rules.
15+ /// </remarks>
716public class PlayerRequestModelValidator : AbstractValidator < PlayerRequestModel >
817{
918 public PlayerRequestModelValidator ( )
1019 {
11- RuleFor ( x => x . FirstName ) . NotEmpty ( ) . WithMessage ( "FirstName is required." ) ;
20+ RuleFor ( player => player . FirstName ) . NotEmpty ( ) . WithMessage ( "FirstName is required." ) ;
1221
13- RuleFor ( x => x . LastName ) . NotEmpty ( ) . WithMessage ( "LastName is required." ) ;
22+ RuleFor ( player => player . LastName ) . NotEmpty ( ) . WithMessage ( "LastName is required." ) ;
1423
15- RuleFor ( x => x . SquadNumber )
24+ RuleFor ( player => player . SquadNumber )
1625 . NotEmpty ( )
1726 . WithMessage ( "SquadNumber is required." )
1827 . GreaterThan ( 0 )
1928 . WithMessage ( "SquadNumber must be greater than 0." ) ;
2029
21- RuleFor ( x => x . AbbrPosition )
30+ RuleFor ( player => player . AbbrPosition )
2231 . NotEmpty ( )
2332 . WithMessage ( "AbbrPosition is required." )
2433 . Must ( Position . IsValidAbbr )
You can’t perform that action at this time.
0 commit comments