19 lines
613 B
C#
19 lines
613 B
C#
using FluentValidation;
|
|
using Shared.DTOs;
|
|
using System;
|
|
|
|
namespace Back.Validations
|
|
{
|
|
public class MobileValidation : AbstractValidator<string>
|
|
{
|
|
public MobileValidation()
|
|
{
|
|
RuleFor(m => m)
|
|
.NotEmpty().WithMessage("موبایل نمی تواند باشد")
|
|
.NotNull().WithMessage("موبایل نمی تواند باشد")
|
|
.Length(11).WithMessage("فرمت موبایل صحیح نمی باشد")
|
|
.Must(m => m.StartsWith("09")).WithMessage("فرمت موبایل صحیح نمی باشد");
|
|
}
|
|
}
|
|
}
|