Spaces:
Running
Running
| using System; | |
| using System.Collections.Generic; | |
| using System.ComponentModel.DataAnnotations; | |
| namespace TaskTrackingSystem.Shared.Models.Project | |
| { | |
| public class UpdateProjectDto : IValidatableObject | |
| { | |
| [] | |
| public string Name { get; set; } = string.Empty; | |
| [] | |
| public string? Description { get; set; } | |
| [] | |
| public DateTime StartDate { get; set; } | |
| [] | |
| public DateTime EndDate { get; set; } | |
| [] | |
| public int? BudgetedHours { get; set; } | |
| public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) | |
| { | |
| if (EndDate < StartDate) | |
| { | |
| yield return new ValidationResult( | |
| "End date cannot be before start date.", | |
| new[] { nameof(EndDate), nameof(StartDate) }); | |
| } | |
| } | |
| } | |
| } | |