изменения сущностей

This commit is contained in:
repka228 2024-11-11 06:21:25 +04:00
parent 1f09536c8e
commit b2c8a278be
4 changed files with 6 additions and 19 deletions

View File

@ -9,10 +9,9 @@ public class Horse
public bool Sex { get; private set; } public bool Sex { get; private set; }
public DateOnly Birthday { get; private set; } public DateOnly Birthday { get; private set; }
public Owner? Owner { get; private set; }
public int OwnerId { get; private set; } public int OwnerId { get; private set; }
public static Horse CreateEntity(int id, string nameOfHorse, bool sex, DateOnly birthday, Owner owner) public static Horse CreateEntity(int id, string nameOfHorse, bool sex, DateOnly birthday, int ownerId)
{ {
return new Horse return new Horse
{ {
@ -20,8 +19,7 @@ public class Horse
NameOfHorse = nameOfHorse, NameOfHorse = nameOfHorse,
Sex = sex, Sex = sex,
Birthday = birthday, Birthday = birthday,
Owner = owner, OwnerId = ownerId
OwnerId = owner.Id
}; };
} }
} }

View File

@ -7,7 +7,6 @@ public class Jockey
public int Age { get; private set; } public int Age { get; private set; }
public int Rating { get; private set; } public int Rating { get; private set; }
public string Number { get; private set; } = string.Empty; public string Number { get; private set; } = string.Empty;
public static Jockey CreateEntity(int id, string nameOfJockey, int age, int rating, string number) public static Jockey CreateEntity(int id, string nameOfJockey, int age, int rating, string number)
{ {
return new Jockey return new Jockey

View File

@ -4,7 +4,6 @@ public class Owner
public int Id { get; private set; } public int Id { get; private set; }
public string NameOfOwner { get; private set; } = string.Empty; public string NameOfOwner { get; private set; } = string.Empty;
public string Number { get; private set; } = string.Empty; public string Number { get; private set; } = string.Empty;
public static Owner CreateEntity(int id, string nameOfOwner, string number) public static Owner CreateEntity(int id, string nameOfOwner, string number)
{ {
return new Owner return new Owner

View File

@ -4,28 +4,19 @@ public class Participants
{ {
public int ParticipantId { get; private set; } public int ParticipantId { get; private set; }
public int JockeyId { get; private set; } public int JockeyId { get; private set; }
public Jockey? Jockey { get; private set; }
public int HorseId { get; private set; } public int HorseId { get; private set; }
public Horse? Horse { get; private set; }
public int CompetitionsId { get; private set; } public int CompetitionsId { get; private set; }
public Competitions? Competitions { get; private set; }
public TimeSpan HorseTime { get; private set; } public TimeSpan HorseTime { get; private set; }
public int HorsePlase { 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) public static Participants CreateEntity(int id, int jockeyId, int horseId, int competitionsId, TimeSpan horseTime, int horsePlace)
{ {
return new Participants return new Participants
{ {
ParticipantId = id, ParticipantId = id,
Jockey = jockey, JockeyId = jockeyId,
JockeyId = jockey.Id, HorseId = horseId,
HorseId = horse.Id, CompetitionsId = competitionsId,
Horse = horse,
Competitions = competitions,
CompetitionsId = competitions.Id,
HorseTime = horseTime, HorseTime = horseTime,
HorsePlase = horsePlace HorsePlase = horsePlace
}; };