fix: cleanup unnecessary usings

This commit is contained in:
2026-04-10 15:56:45 +02:00
parent f7aacdad04
commit 1e25ca809b
6 changed files with 10 additions and 10 deletions
-1
View File
@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-1
View File
@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace TournamentOrganizer.Models;
-1
View File
@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-1
View File
@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+10 -2
View File
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace TournamentOrganizer.Models;
@@ -13,7 +11,9 @@ public class Tournament
public int Id { get; set; }
public int GameId { get; set; }
public int EventId { get; set; }
[CustomValidation(typeof(Tournament), nameof(ValidateDates))]
public DateTime Start { get; set; }
[CustomValidation(typeof(Tournament), nameof(ValidateDates))]
public DateTime End { get; set; }
public RuleSet S1RuleSet { get; set; }
@@ -24,4 +24,12 @@ public class Tournament
public required Game Game { get; set; }
public required Event Event { get; set; }
public static ValidationResult ValidateDates(DateTime date, ValidationContext context)
{
Tournament instance = (Tournament)context.ObjectInstance;
if (date >= instance.Event.Start && date <= instance.Event.End)
return ValidationResult.Success;
return new("Tournament must take place during the event.");
}
}