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

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 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)
public static Horse CreateEntity(int id, string nameOfHorse, bool sex, DateOnly birthday, int ownerId)
{
return new Horse
{
@ -20,8 +19,7 @@ public class Horse
NameOfHorse = nameOfHorse,
Sex = sex,
Birthday = birthday,
Owner = owner,
OwnerId = owner.Id
OwnerId = ownerId
};
}
}

View File

@ -7,7 +7,6 @@ public class Jockey
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

View File

@ -4,7 +4,6 @@ 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

View File

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