Skip to content

Commit

Permalink
Initial work on Students operations UI (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeseggie committed May 23, 2023
1 parent 77c9f6a commit 8eda1bf
Show file tree
Hide file tree
Showing 19 changed files with 798 additions and 31 deletions.
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

0 comments on commit 8eda1bf

Please sign in to comment.