Improve team identifier handling
This commit is contained in:
@@ -83,6 +83,20 @@
|
||||
|
||||
if (result == true)
|
||||
{
|
||||
// If deleting a numbered team (1 or 2), clear the identifier of the remaining team
|
||||
if (team.Identifier == "1" || team.Identifier == "2")
|
||||
{
|
||||
var remainingTeam = await Context.Teams
|
||||
.Include(t => t.Event)
|
||||
.FirstOrDefaultAsync(t => t.Event.Id == team.Event.Id && t.Id != team.Id);
|
||||
|
||||
if (remainingTeam != null)
|
||||
{
|
||||
remainingTeam.Identifier = null;
|
||||
Context.Teams.Update(remainingTeam);
|
||||
}
|
||||
}
|
||||
|
||||
Context.Teams.Remove(team!);
|
||||
await Context.SaveChangesAsync();
|
||||
Snackbar.Add($"Delete event: Delete of Team {team}", Severity.Info);
|
||||
|
||||
Reference in New Issue
Block a user