From 1f09536c8e5df19fedb7e61d2e0e344d2fd6d4fc Mon Sep 17 00:00:00 2001 From: repka228 <54245562+repka228@users.noreply.github.com> Date: Mon, 11 Nov 2024 00:09:18 +0400 Subject: [PATCH] =?UTF-8?q?=D1=81=D1=83=D1=89=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProjectRacing/Entities/Competitions.cs | 18 ++++++++++++++ ProjectRacing/Entities/Horse.cs | 27 +++++++++++++++++++++ ProjectRacing/Entities/Jockey.cs | 22 +++++++++++++++++ ProjectRacing/Entities/Owner.cs | 17 +++++++++++++ ProjectRacing/Entities/Participants.cs | 33 ++++++++++++++++++++++++++ 5 files changed, 117 insertions(+) create mode 100644 ProjectRacing/Entities/Competitions.cs create mode 100644 ProjectRacing/Entities/Horse.cs create mode 100644 ProjectRacing/Entities/Jockey.cs create mode 100644 ProjectRacing/Entities/Owner.cs create mode 100644 ProjectRacing/Entities/Participants.cs diff --git a/ProjectRacing/Entities/Competitions.cs b/ProjectRacing/Entities/Competitions.cs new file mode 100644 index 0000000..83698a5 --- /dev/null +++ b/ProjectRacing/Entities/Competitions.cs @@ -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 + }; + } +} \ No newline at end of file diff --git a/ProjectRacing/Entities/Horse.cs b/ProjectRacing/Entities/Horse.cs new file mode 100644 index 0000000..f19c76c --- /dev/null +++ b/ProjectRacing/Entities/Horse.cs @@ -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 + }; + } +} \ No newline at end of file diff --git a/ProjectRacing/Entities/Jockey.cs b/ProjectRacing/Entities/Jockey.cs new file mode 100644 index 0000000..d1fafaa --- /dev/null +++ b/ProjectRacing/Entities/Jockey.cs @@ -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 + }; + } +} \ No newline at end of file diff --git a/ProjectRacing/Entities/Owner.cs b/ProjectRacing/Entities/Owner.cs new file mode 100644 index 0000000..b31cb7a --- /dev/null +++ b/ProjectRacing/Entities/Owner.cs @@ -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 + }; + } +} \ No newline at end of file diff --git a/ProjectRacing/Entities/Participants.cs b/ProjectRacing/Entities/Participants.cs new file mode 100644 index 0000000..7908a1a --- /dev/null +++ b/ProjectRacing/Entities/Participants.cs @@ -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 + }; + } +}