Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial work on Students operations UI #22

Merged
merged 1 commit into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions src/dev/HESIMS/HESIMS.Web/Components/Students/Students.razor

This file was deleted.

8 changes: 8 additions & 0 deletions src/dev/HESIMS/HESIMS.Web/Data/Applicant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,13 @@ public class Applicant
/// </summary>
public string? OtherNames { get; set; }

/// <summary>
/// Courses applied for by the applicant.
/// </summary>
public IEnumerable<CourseApplication>? CourseApplications { get; set; }

/// <summary>
/// Applicant's student profile.
/// </summary>
public Student? Student { get; set; }
}
2 changes: 2 additions & 0 deletions src/dev/HESIMS/HESIMS.Web/Data/ApplicationDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)

public DbSet<CourseApplication> CourseApplications { get; set; } = default!;

public DbSet<Student> Students { get; set; } = default!;

protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder); // This is required for IdentityDbContext to work.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@ public void Configure(EntityTypeBuilder<Applicant> builder)
builder.HasKey(applicant => applicant.Id);
builder.Property(applicant => applicant.Firstname).IsRequired();
builder.Property(applicant => applicant.Lastname).IsRequired();

builder.HasOne(applicant => applicant.Student)
.WithOne(student => student.Applicant)
.HasForeignKey<Student>(student => student.ApplicantId);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace HESIMS.Web.Data.EntityTypeConfiguration;

/// <summary>
/// Represents configuration of the student entity.
/// </summary>
public class StudentConfiguration : IEntityTypeConfiguration<Student>
{
/// <summary>
/// Configure applicant entity.
/// </summary>
/// <param name="builder"></param>
public void Configure(EntityTypeBuilder<Student> builder)
{
builder.HasKey(student => student.Id);
}
}
Loading