Add Related Careers functionality to EventDefinition entity and update related components
Introduced a many-to-many relationship between EventDefinition and Career entities, allowing for the association of multiple careers with an event. Updated the AppDbContext to include a DbSet for Careers and modified the EventDefinitionConfiguration to handle the new relationship. Enhanced the Create, Edit, and Details components to support input and display of related careers, including normalization and processing logic for career names. Updated the database schema to reflect these changes.
This commit is contained in:
@@ -102,6 +102,22 @@
|
||||
<MudText Typo="Typo.subtitle2" Class="mud-text-secondary">Notes</MudText>
|
||||
<MudText Typo="Typo.body1">@eventdefinition.Notes</MudText>
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudText Typo="Typo.subtitle2" Class="mud-text-secondary">Related Careers</MudText>
|
||||
@if (eventdefinition.RelatedCareers?.Any() == true)
|
||||
{
|
||||
<ul style="margin-top: 8px; padding-left: 20px;">
|
||||
@foreach (var career in eventdefinition.RelatedCareers.OrderBy(c => c.Name))
|
||||
{
|
||||
<li style="margin-bottom: 4px;"><MudText Typo="Typo.body1">@career.Name</MudText></li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudText Typo="Typo.body1" Class="mud-text-secondary">None</MudText>
|
||||
}
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudPaper>
|
||||
|
||||
@@ -116,7 +132,9 @@
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
eventdefinition = await context.Events.FirstOrDefaultAsync(m => m.Id == Id);
|
||||
eventdefinition = await context.Events
|
||||
.Include(e => e.RelatedCareers)
|
||||
.FirstOrDefaultAsync(m => m.Id == Id);
|
||||
|
||||
if (eventdefinition is null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user