This commit is contained in:
2019-01-29 20:22:57 +01:00
8 changed files with 71 additions and 103 deletions

View File

@@ -1,5 +1,6 @@
using LinqToDB.Mapping;
using Newtonsoft.Json;
using SeniorAssistant.Models.Users;
namespace SeniorAssistant.Models
{
@@ -8,17 +9,29 @@ namespace SeniorAssistant.Models
[Column(IsPrimaryKey = true, CanBeNull = false)]
public string Username { get; set; }
[NotNull]
[Column(CanBeNull = false)]
public string Email { get; set; }
[NotNull]
[JsonIgnore]
[Column(CanBeNull = false)]
public string Password { get; set; }
public string Name { get; set; }
public string LastName { get; set; }
public string Avatar { get; set; }
[JsonIgnore]
[Association(ThisKey = nameof(Username), OtherKey = nameof(Doctor.Username), CanBeNull = true)]
public Doctor Doc { get; set; }
[JsonIgnore]
[Association(ThisKey = nameof(Username), OtherKey = nameof(Patient.Username), CanBeNull = true)]
public Patient Pat { get; set; }
public bool IsDoctor() => Doc != null;
public bool IsPatient() => Pat != null;
}
}