Files
game-ideas/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Components/GameValidation.cs
Maxime Adler 3447fa6eb1
All checks were successful
Game Ideas build for PR / build_blazor_app (pull_request) Successful in 1m14s
Add validation and gateway creation
2025-04-14 16:23:45 +02:00

26 lines
586 B
C#

using FluentValidation;
using GameIdeas.Shared.Constants;
using GameIdeas.Shared.Dto;
namespace GameIdeas.BlazorApp.Pages.Games.Components;
public class GameValidation : AbstractValidator<GameDto>
{
public GameValidation()
{
RuleFor(g => g.Title)
.NotEmpty()
.NotNull()
.Matches(GlobalConstants.RegexName);
RuleFor(g => g.ReleaseDate)
.NotEmpty()
.NotNull();
RuleFor(g => g.Interest)
.NotNull()
.GreaterThanOrEqualTo(1)
.LessThanOrEqualTo(5);
}
}