Spaces:
Running
Running
File size: 949 Bytes
3418204 bec15e2 3418204 bec15e2 3418204 3bd1468 bec15e2 3bd1468 bec15e2 3418204 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace TaskTrackingSystem.Shared.Models.Project
{
public class UpdateProjectDto : IValidatableObject
{
[Required, MaxLength(150)]
public string Name { get; set; } = string.Empty;
[MaxLength(500)]
public string? Description { get; set; }
[Required]
public DateTime StartDate { get; set; }
[Required]
public DateTime EndDate { get; set; }
[Range(0, 100000)]
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) });
}
}
}
}
|