Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
22 lines (19 sloc) 592 Bytes
using FluentValidation;
using System;
namespace Scheduler.API.ViewModels.Validations
{
public class ScheduleViewModelValidator : AbstractValidator<ScheduleViewModel>
{
public ScheduleViewModelValidator()
{
RuleFor(s => s.TimeEnd).Must((start, end) =>
{
return DateTimeIsGreater(start.TimeStart, end);
}).WithMessage("Schedule's End time must be greater than Start time");
}
private bool DateTimeIsGreater(DateTime start, DateTime end)
{
return end > start;
}
}
}