Fix formatting issue in Team entity and improve ToString method for null safety
This commit addresses a formatting issue in the Team.cs file by removing an invisible character at the beginning of the file. Additionally, the ToString method is updated to safely handle null values for the Event property, ensuring that it returns a default message when no event is associated with the team. These changes enhance code readability and prevent potential null reference exceptions.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Core.Models;
|
||||
|
||||
namespace Core.Entities;
|
||||
@@ -61,6 +61,6 @@ public class Team
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Event.Name} {(Identifier != null ? $"({Identifier})" : "")}";
|
||||
return $"{Event?.Name ?? "(no event)"} {(Identifier != null ? $"({Identifier})" : "")}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user