我正在 Asp.net Core 中开发一个 API。我有联系人和职位模型。
联系人.cs
public class Contact
{
[Key]
public int ContactId { get; set; }
//public string UserId { get; set; }
[Required]
[StringLength(20)]
public string FirstName { get; set; }
[StringLength(20)]
public string MiddleName { get; set; }
[Required]
[StringLength(20)]
public string LastName { get; set; }
[StringLength(60)]
public string FullName { get; set; }
[Required]
public Gender Gender { get; set; }
[Required]
public DateTime DateOfBirth { get; set; }
public MaritalStatus MaritalStatus { get; set; }
[Required]
public JobTitle JobTitle { get; set; }
[Required]
[EmailAddress]
[StringLength(50)]
public string Email { get; set; }
public int Phone { get; set; }
[Required]
public int Mobile { get; set; }
public string Address { get; set; }
public string Photo { get; set; }
public bool IsDeleted { get; set; }
public DateTime CreatedOn { get; set; }
public DateTime UpdatedOn { get; set; }
}
public enum Gender
{
Male = 0,
Female = 1
}
public enum MaritalStatus
{
Unmarried = 0,
Married = 1,
Divorced = 2,
Widowed = 3
}
职称.cs
public class JobTitle
{
[Key]
public int Id { get; set; }
[Required]
[StringLength(50)]
public string Name { get; set; }
[Required]
[StringLength(50)]
public string NameAr { get; set; }
public bool IsDeleted { get; set; }
public DateTime? CreatedOn { get; set; }
public DateTime? UpdatedOn { get; set; }
public virtual ICollection<Contact> Contact { get; set; }
}
我知道问题是 API 需要参考中的 jobtitle 对象,但我不知道如何给出它,因为它没有达到我在 Visual Studio 中的后断点。那么如何获取 jobtitle 的值并进行转换呢?
qq_花开花谢_0
拉风的咖菲猫
相关分类