Add style for game creation
All checks were successful
Game Ideas build for PR / build_blazor_app (pull_request) Successful in 40s

This commit is contained in:
2025-04-14 21:03:34 +02:00
parent 3447fa6eb1
commit 1b7a43e2ac
8 changed files with 103 additions and 57 deletions

View File

@@ -1,5 +1,5 @@
using FluentValidation;
using GameIdeas.Shared.Constants;
using GameIdeas.Resources;
using GameIdeas.Shared.Dto;
namespace GameIdeas.BlazorApp.Pages.Games.Components;
@@ -9,17 +9,10 @@ public class GameValidation : AbstractValidator<GameDto>
public GameValidation()
{
RuleFor(g => g.Title)
.NotEmpty()
.NotNull()
.Matches(GlobalConstants.RegexName);
RuleFor(g => g.ReleaseDate)
.NotEmpty()
.NotNull();
.NotEmpty().WithMessage(ResourcesKey.InvalidTitle);
RuleFor(g => g.Interest)
.NotNull()
.GreaterThanOrEqualTo(1)
.LessThanOrEqualTo(5);
.GreaterThanOrEqualTo(1).WithMessage(ResourcesKey.InvalidInterest)
.LessThanOrEqualTo(5).WithMessage(ResourcesKey.InvalidInterest);
}
}