Added data annotations

This commit is contained in:
2023-11-21 12:19:44 +01:00
parent cef7d1711a
commit 0b200effb9
4 changed files with 47 additions and 10 deletions

View File

@@ -1,17 +1,25 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WD7UVN_HFT_2023241.Models
{
internal class Customer
public class Customer
{
[Key]
public int ID { get; set; }
[Required]
[StringLength(240)]
public string NAME { get; set; }
[StringLength(240)]
public string EMAIL { get; set; }
[StringLength(240)]
public string PHONE { get; set; }
[ForeignKey(nameof(Service))]
public int SERVICE_ID { get; set; }
}
}

View File

@@ -1,18 +1,27 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WD7UVN_HFT_2023241.Models
{
internal class Employee
public class Employee
{
[Key]
public int ID { get; set; }
[Required]
[StringLength(240)]
public string NAME { get; set; }
[StringLength(240)]
public string EMAIL { get; set; }
[StringLength(240)]
public string PHONE { get; set; }
[ForeignKey(nameof(MaintainerTeam))]
public int MAINTAINER_ID { get; set; }
[ForeignKey(nameof(Employee))]
public int MANAGER { get; set; }
}
}

View File

@@ -1,12 +1,20 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace WD7UVN_HFT_2023241.Models
{
public class MaintainerTeam
{
[Key]
public int ID { get; set; }
[Required]
[StringLength(240)]
public string NAME { get; set; }
[StringLength(240)]
public string EMAIL { get; set; }
[Required]
[ForeignKey(nameof(Employee))]
public int LEADER_EMPLOYEE_ID { get; set; }
}
}

View File

@@ -1,15 +1,27 @@
namespace WD7UVN_HFT_2023241.Models
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace WD7UVN_HFT_2023241.Models
{
internal class Service
public class Service
{
[Key]
public int ID { get; set; }
[ForeignKey(nameof(MaintainerTeam))]
[Required]
public int MAINTAINER { get; set; }
[Required]
public string NAME { get; set; }
public int? VERSION { get; set; }
public string? ACCOUNT { get; set; }
public string? NOTES { get; set; }
public string? SERVICE_DOMAIN { get; set; }
public string? IP { get; set; }
public int? PORT { get; set; }
public int VERSION { get; set; }
[StringLength(240)]
public string ACCOUNT { get; set; }
[StringLength(240)]
public string NOTES { get; set; }
[StringLength(240)]
public string SERVICE_DOMAIN { get; set; }
[StringLength(240)]
public string IP { get; set; }
[StringLength(240)]
public int PORT { get; set; }
}
}