Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9dd158bd4c | ||
|
b2c8a278be | ||
|
1f09536c8e |
18
ProjectRacing/Entities/Competitions.cs
Normal file
18
ProjectRacing/Entities/Competitions.cs
Normal 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
|
||||
};
|
||||
}
|
||||
}
|
25
ProjectRacing/Entities/Horse.cs
Normal file
25
ProjectRacing/Entities/Horse.cs
Normal file
@ -0,0 +1,25 @@
|
||||
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 int OwnerId { get; private set; }
|
||||
|
||||
public static Horse CreateEntity(int id, string nameOfHorse, bool sex, DateOnly birthday, int ownerId)
|
||||
{
|
||||
return new Horse
|
||||
{
|
||||
Id = id,
|
||||
NameOfHorse = nameOfHorse,
|
||||
Sex = sex,
|
||||
Birthday = birthday,
|
||||
OwnerId = ownerId
|
||||
};
|
||||
}
|
||||
}
|
21
ProjectRacing/Entities/Jockey.cs
Normal file
21
ProjectRacing/Entities/Jockey.cs
Normal file
@ -0,0 +1,21 @@
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
16
ProjectRacing/Entities/Owner.cs
Normal file
16
ProjectRacing/Entities/Owner.cs
Normal file
@ -0,0 +1,16 @@
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
24
ProjectRacing/Entities/Participants.cs
Normal file
24
ProjectRacing/Entities/Participants.cs
Normal file
@ -0,0 +1,24 @@
|
||||
namespace ProjectRacing.Entities;
|
||||
|
||||
public class Participants
|
||||
{
|
||||
public int ParticipantId { get; private set; }
|
||||
public int JockeyId { get; private set; }
|
||||
public int HorseId { get; private set; }
|
||||
public int CompetitionsId { get; private set; }
|
||||
public TimeSpan HorseTime { get; private set; }
|
||||
public int HorsePlase { get; private set; }
|
||||
|
||||
public static Participants CreateEntity(int id, int jockeyId, int horseId, int competitionsId, TimeSpan horseTime, int horsePlace)
|
||||
{
|
||||
return new Participants
|
||||
{
|
||||
ParticipantId = id,
|
||||
JockeyId = jockeyId,
|
||||
HorseId = horseId,
|
||||
CompetitionsId = competitionsId,
|
||||
HorseTime = horseTime,
|
||||
HorsePlase = horsePlace
|
||||
};
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
namespace ProjectRacing
|
||||
{
|
||||
partial class Form1
|
||||
partial class FormRacing
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
@ -1,8 +1,8 @@
|
||||
namespace ProjectRacing
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
public partial class FormRacing : Form
|
||||
{
|
||||
public Form1()
|
||||
public FormRacing()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
@ -1,3 +1,7 @@
|
||||
using ProjectRacing.Repositories;
|
||||
using ProjectRacing.Repositories.Implementations;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectRacing
|
||||
{
|
||||
internal static class Program
|
||||
@ -11,7 +15,18 @@ namespace ProjectRacing
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
Application.Run(CreateContainer().Resolve<FormRacing>());
|
||||
}
|
||||
|
||||
private static IUnityContainer CreateContainer()
|
||||
{
|
||||
var container = new UnityContainer();
|
||||
container.RegisterType<ICompetitionsRepository, CompetitionsRepository>();
|
||||
container.RegisterType<IHorseRepository, HorseRepository>();
|
||||
container.RegisterType<IJockeyRepository, JockeyRepository>();
|
||||
container.RegisterType<IOwnerRepository, OwnerRepository>();
|
||||
container.RegisterType<IParticipantsRepository, ParticipantsRepository>();
|
||||
return container;
|
||||
}
|
||||
}
|
||||
}
|
@ -8,4 +8,8 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Unity" Version="5.11.10" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
11
ProjectRacing/Repositories/ICompetitionsRepository.cs
Normal file
11
ProjectRacing/Repositories/ICompetitionsRepository.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using ProjectRacing.Entities;
|
||||
|
||||
namespace ProjectRacing.Repositories;
|
||||
public interface ICompetitionsRepository
|
||||
{
|
||||
IEnumerable<Competitions> GetCompetitionses();
|
||||
Competitions GetCompetitionsById(int id);
|
||||
void CreateCompetitions(Competitions competitions);
|
||||
void UpdateCompetitions(Competitions competitions);
|
||||
void DeleteCompetitions(int id);
|
||||
}
|
10
ProjectRacing/Repositories/IHorseRepository.cs
Normal file
10
ProjectRacing/Repositories/IHorseRepository.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using ProjectRacing.Entities;
|
||||
namespace ProjectRacing.Repositories;
|
||||
public interface IHorseRepository
|
||||
{
|
||||
IEnumerable<Horse> GetHorses();
|
||||
Horse GetHorseById(int id);
|
||||
void CreateHorse(Horse horse);
|
||||
void UpdateHorse(Horse horse);
|
||||
void DeleteHorse(int id);
|
||||
}
|
11
ProjectRacing/Repositories/IJockeyRepository.cs
Normal file
11
ProjectRacing/Repositories/IJockeyRepository.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using ProjectRacing.Entities;
|
||||
|
||||
namespace ProjectRacing.Repositories;
|
||||
public interface IJockeyRepository
|
||||
{
|
||||
IEnumerable<Jockey> GetJockeys();
|
||||
Jockey GetJockeyById(int id);
|
||||
void CreateJockey(Jockey jockey);
|
||||
void UpdateJockey(Jockey jockey);
|
||||
void DeleteJockey(int id);
|
||||
}
|
11
ProjectRacing/Repositories/IOwnerRepository.cs
Normal file
11
ProjectRacing/Repositories/IOwnerRepository.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using ProjectRacing.Entities;
|
||||
|
||||
namespace ProjectRacing.Repositories;
|
||||
public interface IOwnerRepository
|
||||
{
|
||||
IEnumerable<Owner> GetOwner();
|
||||
Owner GetOwnerById(int id);
|
||||
void CreateOwner(Owner owner);
|
||||
void UpdateOwner(Owner owner);
|
||||
void DeleteOwner(int id);
|
||||
}
|
11
ProjectRacing/Repositories/IParticipantsRepository.cs
Normal file
11
ProjectRacing/Repositories/IParticipantsRepository.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using ProjectRacing.Entities;
|
||||
|
||||
namespace ProjectRacing.Repositories;
|
||||
public interface IParticipantsRepository
|
||||
{
|
||||
IEnumerable<Participants> GetParticipants();
|
||||
Participants GetParticipantsById(int id);
|
||||
void CreateParticipants(Participants participants);
|
||||
void UpdateParticipants(Participants participants);
|
||||
void DeleteParticipants(int id);
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
using ProjectRacing.Entities;
|
||||
namespace ProjectRacing.Repositories.Implementations;
|
||||
internal class CompetitionsRepository : ICompetitionsRepository
|
||||
{
|
||||
public void CreateCompetitions(Competitions competitions)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteCompetitions(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Competitions GetCompetitionsById(int id)
|
||||
{
|
||||
return Competitions.CreateEntity(0, new DateOnly(0001,1,1), string.Empty);
|
||||
}
|
||||
|
||||
public IEnumerable<Competitions> GetCompetitionses()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateCompetitions(Competitions competitions)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
using ProjectRacing.Entities;
|
||||
namespace ProjectRacing.Repositories.Implementations;
|
||||
public class HorseRepository : IHorseRepository
|
||||
{
|
||||
public void CreateHorse(Horse horse)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteHorse(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Horse GetHorseById(int id)
|
||||
{
|
||||
return Horse.CreateEntity(0, string.Empty, true, new DateOnly(0001, 1, 1), 0);
|
||||
}
|
||||
|
||||
public IEnumerable<Horse> GetHorses()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateHorse(Horse horse)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
using ProjectRacing.Entities;
|
||||
namespace ProjectRacing.Repositories.Implementations;
|
||||
internal class JockeyRepository : IJockeyRepository
|
||||
{
|
||||
public void CreateJockey(Jockey jockey)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteJockey(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Jockey GetJockeyById(int id)
|
||||
{
|
||||
return Jockey.CreateEntity(0, string.Empty, 0, 0, string.Empty);
|
||||
}
|
||||
|
||||
public IEnumerable<Jockey> GetJockeys()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateJockey(Jockey jockey)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
using ProjectRacing.Entities;
|
||||
namespace ProjectRacing.Repositories.Implementations;
|
||||
internal class OwnerRepository : IOwnerRepository
|
||||
{
|
||||
public void CreateOwner(Owner owner)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteOwner(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IEnumerable<Owner> GetOwner()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public Owner GetOwnerById(int id)
|
||||
{
|
||||
return Owner.CreateEntity(0, string.Empty, string.Empty);
|
||||
}
|
||||
|
||||
public void UpdateOwner(Owner owner)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
using ProjectRacing.Entities;
|
||||
namespace ProjectRacing.Repositories.Implementations;
|
||||
internal class ParticipantsRepository : IParticipantsRepository
|
||||
{
|
||||
public void CreateParticipants(Participants participants)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteParticipants(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public IEnumerable<Participants> GetParticipants()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public Participants GetParticipantsById(int id)
|
||||
{
|
||||
return Participants.CreateEntity(0, 0, 0, 0, TimeSpan.Zero, 0);
|
||||
}
|
||||
|
||||
public void UpdateParticipants(Participants participants)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user