public CreatePlayerCommandValidator(ISportsManagementDbContext context)
        {
            _context = context;

            RuleFor(x => x.FirstName).NotNull().NotEmpty();
            RuleFor(x => x.Position).NotNull().NotEmpty();
            RuleFor(x => x.Position).Must(IsValidPosition).WithMessage("'Position' is invalid. Valid Positions are [GoalKeeper, Defender, Midfielder, Attacker ]");
            RuleFor(x => x.Nationality).NotNull().NotEmpty();
            RuleFor(x => x.Nationality).Must(IsValidNationality).WithMessage("'Nationality' is invalid. Valid Nationalities are [Sweden, England, France, Spain, Germany, Scotland, Brazil, Portugal, Norway]");
            RuleFor(x => x.JerseyNumber).GreaterThan(0);
            RuleFor(x => x.JerseyNumber).Must(IsValidJerseyNumber).WithMessage("'Jersey Number' already assigned");
        }
 public GetAllPlayersQueryHandler(IUserContext userContext, ISportsManagementDbContext context, IMapper mapper) : base(userContext)
 {
     _context = context;
     _mapper  = mapper;
 }
 public UpdatePlayerCommandHandler(IUserContext userContext, ISportsManagementDbContext context) : base(userContext)
 {
     _context = context;
 }
예제 #4
0
 public CreatePlayerCommandHandler(IUserContext userContext, ISportsManagementDbContext context, IMapper mapper) : base(userContext)
 {
     _context = context;
     _mapper  = mapper;
 }
 public GetFixturesQueryHandler(IUserContext userContext, ISportsManagementDbContext context) : base(userContext)
 {
     _context = context;
 }
예제 #6
0
 public AuthenticateUserCommandHandler(ISportsManagementDbContext context, IOptions <JwtConfig> jwtSettings, IMapper mapper)
 {
     _context     = context;
     _mapper      = mapper;
     _jwtSettings = jwtSettings.Value;
 }