add user database links
This commit is contained in:
parent
cc04070287
commit
48db39218d
@ -17,6 +17,8 @@ namespace UniversityDatabaseImplement.Models
|
||||
public virtual List<StatementStudent> StatementStudents { get; set; } = new();
|
||||
[ForeignKey("StudentId")]
|
||||
public virtual List<StudentExaminationResult> StudentExaminationResults { get; set; } = new();
|
||||
[ForeignKey("StudentId")]
|
||||
public virtual List<UserStudent> StudentUsers { get; set; } = new();
|
||||
|
||||
private Dictionary<int, IStatementModel>? _statements;
|
||||
[NotMapped]
|
||||
|
@ -21,6 +21,10 @@ namespace UniversityDatabaseImplement.Models
|
||||
public string Login { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
[ForeignKey("UserId")]
|
||||
public virtual List<UserStudent> StudentUsers { get; set; } = new();
|
||||
[ForeignKey("UserId")]
|
||||
public virtual List<Statement> Statements { get; set; } = new();
|
||||
public static User Create(UserBindingModel model)
|
||||
{
|
||||
return new User
|
||||
|
15
University/DatabaseImplement/Models/UserStudent.cs
Normal file
15
University/DatabaseImplement/Models/UserStudent.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace UniversityDatabaseImplement.Models
|
||||
{
|
||||
public class UserStudent
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int StudentTypeId { get; set; }
|
||||
[Required]
|
||||
public int UserId { get; set; }
|
||||
public virtual Student Student { get; set; } = new();
|
||||
public virtual User User { get; set; } = new();
|
||||
}
|
||||
}
|
@ -24,5 +24,6 @@ namespace UniversityDatabaseImplement
|
||||
public virtual DbSet<Student> Students { set; get; }
|
||||
public virtual DbSet<StudentExaminationResult> StudentExaminationResults { set; get; }
|
||||
public virtual DbSet<User> Users { set; get; }
|
||||
public virtual DbSet<UserStudent> UserStudents { set; get; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user