58 lines
1.4 KiB
C#
58 lines
1.4 KiB
C#
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace YourProject.Models
|
|
{
|
|
public class Project
|
|
{
|
|
[Key]
|
|
public string ProjectId { get; set; } = string.Empty;
|
|
|
|
[Required]
|
|
public string ClientId { get; set; } = string.Empty;
|
|
|
|
[Required]
|
|
[MaxLength(200)]
|
|
public string Name { get; set; } = string.Empty;
|
|
|
|
[MaxLength(1000)]
|
|
public string? Description { get; set; }
|
|
|
|
public DateOnly? StartDate { get; set; }
|
|
|
|
public DateOnly? EndDate { get; set; }
|
|
|
|
[Range(0, double.MaxValue)]
|
|
public decimal Budget { get; set; } = 0;
|
|
|
|
public ProjectStatus Status { get; set; } = ProjectStatus.Active;
|
|
|
|
[Range(0, double.MaxValue)]
|
|
public decimal? HourlyRate { get; set; }
|
|
|
|
[MaxLength(2000)]
|
|
public string? Notes { get; set; }
|
|
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
// Optional navigation property (for Entity Framework Core)
|
|
public Client? Client { get; set; }
|
|
|
|
// Helper method
|
|
public void UpdateTimestamp()
|
|
{
|
|
UpdatedAt = DateTime.UtcNow;
|
|
}
|
|
}
|
|
|
|
public enum ProjectStatus
|
|
{
|
|
Active = 0,
|
|
OnHold = 1,
|
|
Completed = 2,
|
|
Cancelled = 3
|
|
}
|
|
}
|