fix: cleanup unnecessary usings
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
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;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace TournamentOrganizer.Models;
|
namespace TournamentOrganizer.Models;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace TournamentOrganizer.Models;
|
namespace TournamentOrganizer.Models;
|
||||||
|
|
||||||
@@ -13,7 +11,9 @@ public class Tournament
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int GameId { get; set; }
|
public int GameId { get; set; }
|
||||||
public int EventId { get; set; }
|
public int EventId { get; set; }
|
||||||
|
[CustomValidation(typeof(Tournament), nameof(ValidateDates))]
|
||||||
public DateTime Start { get; set; }
|
public DateTime Start { get; set; }
|
||||||
|
[CustomValidation(typeof(Tournament), nameof(ValidateDates))]
|
||||||
public DateTime End { get; set; }
|
public DateTime End { get; set; }
|
||||||
|
|
||||||
public RuleSet S1RuleSet { get; set; }
|
public RuleSet S1RuleSet { get; set; }
|
||||||
@@ -24,4 +24,12 @@ public class Tournament
|
|||||||
public required Game Game { get; set; }
|
public required Game Game { get; set; }
|
||||||
public required Event Event { 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.");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user