23 lines
593 B
C#
23 lines
593 B
C#
using FluentValidation;
|
|
|
|
namespace InternshipSystem.Api.Queries
|
|
{
|
|
public class CourseForm
|
|
{
|
|
public long? Id { get; set; }
|
|
public string Name { get; set; }
|
|
public string NameEng { get; set; }
|
|
|
|
public class Validator : AbstractValidator<CourseForm>
|
|
{
|
|
public Validator()
|
|
{
|
|
RuleFor(c => c.Id).NotNull()
|
|
.When(c => string.IsNullOrWhiteSpace(c.Name));
|
|
|
|
RuleFor(c => c.Name).NotEmpty()
|
|
.When(c => !c.Id.HasValue);
|
|
}
|
|
}
|
|
}
|
|
} |