сущности

This commit is contained in:
repka228 2024-11-11 00:09:18 +04:00
parent 8f25b5cc1a
commit 1f09536c8e
5 changed files with 117 additions and 0 deletions

View File

@ -0,0 +1,18 @@
namespace ProjectRacing.Entities;
public class Competitions
{
public int Id { get; set; }
public DateOnly DateOfCompetitions { get; set; }
public string Adress { get; set; } = string.Empty;
public static Competitions CreateEntity(int id, DateOnly dateOfCompetitions, string adress)
{
return new Competitions
{
Id = id,
Adress = adress,
DateOfCompetitions = dateOfCompetitions
};
}
}

View File

@ -0,0 +1,27 @@
namespace ProjectRacing.Entities;
public class Horse
{
public int Id { get; private set; }
public string NameOfHorse { get; private set; } = string.Empty;
public bool Sex { get; private set; }
public DateOnly Birthday { get; private set; }
public Owner? Owner { get; private set; }
public int OwnerId { get; private set; }
public static Horse CreateEntity(int id, string nameOfHorse, bool sex, DateOnly birthday, Owner owner)
{
return new Horse
{
Id = id,
NameOfHorse = nameOfHorse,
Sex = sex,
Birthday = birthday,
Owner = owner,
OwnerId = owner.Id
};
}
}

View File

@ -0,0 +1,22 @@
namespace ProjectRacing.Entities;
public class Jockey
{
public int Id { get; private set; }
public string NameOfJockey { get; private set; } = string.Empty;
public int Age { get; private set; }
public int Rating { get; private set; }
public string Number { get; private set; } = string.Empty;
public static Jockey CreateEntity(int id, string nameOfJockey, int age, int rating, string number)
{
return new Jockey
{
Id = id,
NameOfJockey = nameOfJockey,
Age = age,
Rating = rating,
Number = number
};
}
}

View File

@ -0,0 +1,17 @@
namespace ProjectRacing.Entities;
public class Owner
{
public int Id { get; private set; }
public string NameOfOwner { get; private set; } = string.Empty;
public string Number { get; private set; } = string.Empty;
public static Owner CreateEntity(int id, string nameOfOwner, string number)
{
return new Owner
{
Id = id,
NameOfOwner = nameOfOwner,
Number = number
};
}
}

View File

@ -0,0 +1,33 @@
namespace ProjectRacing.Entities;
public class Participants
{
public int ParticipantId { get; private set; }
public int JockeyId { get; private set; }
public Jockey? Jockey { get; private set; }
public int HorseId { get; private set; }
public Horse? Horse { get; private set; }
public int CompetitionsId { get; private set; }
public Competitions? Competitions { get; private set; }
public TimeSpan HorseTime { get; private set; }
public int HorsePlase { get; private set; }
public static Participants CreateEntity(int id, Jockey jockey, Horse horse, Competitions competitions, TimeSpan horseTime, int horsePlace)
{
return new Participants
{
ParticipantId = id,
Jockey = jockey,
JockeyId = jockey.Id,
HorseId = horse.Id,
Horse = horse,
Competitions = competitions,
CompetitionsId = competitions.Id,
HorseTime = horseTime,
HorsePlase = horsePlace
};
}
}