Skip to main content

Overview

Match management allows you to schedule games between registered teams, set match dates and times, and record scores for both home and away teams. The system tracks all matches in the tournament with complete details about participating teams and results.
Creating, editing, and deleting matches requires authentication. Only logged-in users can manage match schedules.

Match Structure

Every match in the system contains:
  • Date and Time: When the match is scheduled to take place
  • Home Team (Local): The team playing at their home venue
  • Away Team (Visitante): The visiting team
  • Home Score (Marcador Local): Goals scored by the home team (0-100)
  • Away Score (Marcador Visitante): Goals scored by the away team (0-100)

Creating a New Match

1

Access the Create Match Page

Navigate to the Matches section and click “Create New Match” or similar action.Requirement: You must be logged in to access this page.Prerequisite: At least 2 teams must exist in the system to schedule a match.
2

Select Match Date and Time

Choose when the match will take place:
  • Required: Yes, date and time are mandatory
  • Format: DateTime field with date and time picker
  • Validation: Cannot be empty
The system uses this to prevent duplicate matches and organize the schedule.
3

Select Home Team (Local)

Choose the team that will play at home:
  • Select from dropdown of all registered teams
  • This team’s venue is considered the match location
  • Will be displayed as “Local” in match listings
4

Select Away Team (Visitante)

Choose the visiting team:
  • Select from dropdown of all registered teams
  • Can be any team except the home team
  • Will be displayed as “Visitante” in match listings
5

Enter Match Scores

Record the final scores for both teams:Home Score (Marcador Local)
  • Required field
  • Must be between 0 and 100
  • Numeric values only
Away Score (Marcador Visitante)
  • Required field
  • Must be between 0 and 100
  • Numeric values only
You can create matches with scores of 0-0 for scheduling future games, then edit to update scores after the match is played.
6

Validate and Submit

The system validates:
  • Date and time are provided
  • Both teams are selected
  • Scores are within valid range (0-100)
  • No duplicate match exists (same teams and exact date/time)
On successful validation, the match is created and you’re redirected to the Matches Index.

Viewing Matches

The Matches Index page displays all scheduled matches:

Match List Display

Each match shows:
  • Date and time of the match
  • Home team (Local) name
  • Home team score
  • Away team (Visitante) name
  • Away team score
  • Action buttons (View Details, Edit, Delete)

Typical Display Format

Date/Time: March 15, 2026 - 3:00 PM
Local: Team A (2) vs Visitante: Team B (1)

Editing Match Details

Editing matches requires authentication.
1

Select Match to Edit

From the Matches Index, click the “Edit” button next to the match you want to modify.
2

Review Current Information

The edit form displays:
  • Current date and time
  • Currently selected home team (pre-selected in dropdown)
  • Current home score
  • Currently selected away team (pre-selected in dropdown)
  • Current away score
3

Make Changes

You can modify any match attribute:
Update the date and time to reschedule the game to a different slot.
4

Duplicate Validation

The system checks for duplicate matches:
  • If another match exists with the same home team, away team, and exact date/time
  • If duplicate detected, you see an error message
  • Modify at least one field to make the match unique
5

Save Changes

Click submit to save updates. On success, you’re redirected to the Matches Index with the updated information.

Deleting Matches

Deleting a match permanently removes it from the system. This action cannot be undone.
1

Select Match

Find the match you want to remove in the Matches Index.
2

Initiate Deletion

Click the “Delete” button next to the match.
3

Handle Deletion

  • Success: If deletion is allowed, the match is removed immediately
  • Error: If there are constraints preventing deletion, you’ll see an error message (ErrorEliminar = true)
The matches list refreshes to show remaining matches.

Validation Rules

Display Name: “Fecha y hora del partido” (Match date and time)
  • Required: Yes
  • Type: DateTime
  • Format: Full date and time
  • Null Handling: Cannot be null or empty
Error Message:
  • “La fecha del partido es obligatoria” (Match date is required)
  • Required: Yes
  • Type: Foreign key reference to Team entity
  • Selection: Dropdown with all available teams
  • Relationship: One match has one home team
Display Name: “Marcador Local”
  • Required: Yes
  • Type: Integer
  • Range: 0 to 100
  • Minimum: 0 (no negative scores)
  • Maximum: 100 (upper limit for data integrity)
Error Messages:
  • “El Marcador Local es obligatorio” (Home score is required)
  • “Marcador Local debe estar en un rango entre 0 y 100” (Score must be 0-100)
  • Required: Yes
  • Type: Foreign key reference to Team entity
  • Selection: Dropdown with all available teams
  • Relationship: One match has one away team
Display Name: “Marcador Visitante”
  • Required: Yes
  • Type: Integer
  • Range: 0 to 100
  • Minimum: 0 (no negative scores)
  • Maximum: 100 (upper limit for data integrity)
Error Messages:
  • “El Marcador Visitante es obligatoria” (Away score is required)
  • “Marcador Visitante debe estar en un rango entre 0 y 100” (Score must be 0-100)
A match is considered duplicate if ALL of these match an existing match:
  • Same home team (Local)
  • Same away team (Visitante)
  • Same exact date and time
This allows:
  • Same teams playing at different times
  • Different teams playing at the same time
  • Rematch between teams on different dates

Prerequisites for Creating Matches

Minimum Two Teams Required

At least 2 teams must be registered in the system before you can schedule a match.Validation: equiposExits = equipos.Count() >= 2 ? true : falseIf fewer than 2 teams exist, the creation page displays a warning and may disable match creation.

Match Relationships

Home Team Relationship

  • Property: Local
  • Type: Many-to-One
  • Description: Many matches can have the same home team
  • Required: Yes
  • Inverse Property: Team has PartidosLocal collection

Away Team Relationship

  • Property: Visitante
  • Type: Many-to-One
  • Description: Many matches can have the same away team
  • Required: Yes
  • Inverse Property: Team has PartidosVisitante collection

Common Workflows

Scenario: Planning a match that hasn’t been played yet
  1. Navigate to Matches > Create New
  2. Select future date and time
  3. Choose home team
  4. Choose away team
  5. Enter 0 for both scores (or leave as default)
  6. Submit form
  7. Match appears in schedule
  8. Edit later to update scores after match is played

Score Range Explanation

The system allows scores from 0 to 100:
  • Typical Range: Most soccer matches have scores between 0-10
  • Extended Range: The 0-100 range accommodates:
    • Standard soccer matches
    • Aggregate scores (if tracking tournament totals)
    • Unusual high-scoring games
    • Data integrity and testing scenarios
While the technical limit is 100, typical soccer matches rarely exceed single digits. The validation exists primarily for data integrity rather than reflecting common game outcomes.

Error Handling

Condition: Creating or editing a match with same home team, away team, and date/time as existing match.Result:
  • duplicate = true
  • Error message displayed
  • Form redisplays with current input preserved
  • Team selections remain populated
  • User must modify teams or date/time to proceed
Condition: Fewer than 2 teams exist in the system.Result:
  • equiposExits = false
  • Warning message displayed on creation page
  • Cannot create match until more teams are registered
  • User directed to create teams first
Condition: Invalid input (missing date, scores out of range, etc.).Result:
  • ModelState.IsValid = false
  • Specific error messages for each invalid field
  • Form redisplays with user input
  • Dropdowns repopulated with available teams
Condition: Unable to delete match due to constraints.Result:
  • ErrorEliminar = true
  • Error message displayed in Matches Index
  • Match remains in system
  • Matches list refreshes to show all matches

Data Model

The match entity structure from the source code:
public class Partido
{
    public int Id { get; set; }
    
    [Display(Name = "Fecha y hora del partido")]
    [Required(ErrorMessage = "La fecha del partido es obligatoria.")]
    public DateTime FechaHora { get; set; }
    
    public Equipo? Local { get; set; }
    
    [Display(Name = "Marcador Local")]
    [Required(ErrorMessage = "El Marcador Local es obligatorio.")]
    [Range(0, 100)]
    public int MarcadorLocal { get; set; }
    
    public Equipo? Visitante { get; set; }
    
    [Display(Name = "Marcador Visitante")]
    [Required(ErrorMessage = "El Marcador Visitante es obligatoria.")]
    [Range(0, 100)]
    public int MarcadorVisitante { get; set; }
}

Team Match History

Each team maintains relationships to their matches:
public class Equipo
{
    [InverseProperty("Local")]
    public List<Partido>? PartidosLocal { get; set; }
    
    [InverseProperty("Visitante")]
    public List<Partido>? PartidosVisitante { get; set; }
}
This allows tracking:
  • All matches where a team played at home
  • All matches where a team played away
  • Complete match history for each team
  • Team performance statistics

Best Practices

Schedule in Advance

Create matches with future dates and 0-0 scores, then update results after games are played.

Verify Teams

Double-check you’ve selected the correct home and away teams before submitting.

Accurate Timing

Enter precise date and time to avoid scheduling conflicts and duplicate detection issues.

Update Promptly

Record match results soon after games are completed for accurate tournament tracking.

Team Management

Create and manage teams that participate in matches

Tournament Overview

Complete tournament management system guide

Player Management

Manage players on teams that compete in matches

Authentication

Login requirements for match management

Build docs developers (and LLMs) love