Добавили реализацию интерфейсов, добавили контейнер
This commit is contained in:
parent
b130453828
commit
0265c4ebfc
@ -1,6 +1,6 @@
|
||||
namespace ProjectTourAgency
|
||||
{
|
||||
partial class Form1
|
||||
partial class FormTourAgency
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
@ -1,8 +1,8 @@
|
||||
namespace ProjectTourAgency
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
public partial class FormTourAgency : Form
|
||||
{
|
||||
public Form1()
|
||||
public FormTourAgency()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Implementations;
|
||||
|
||||
public class ClientRepository : IClientRepository
|
||||
{
|
||||
public void CreateClient(Client client)
|
||||
{
|
||||
}
|
||||
|
||||
public void DeleteClient(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public Client ReadClientById(int id)
|
||||
{
|
||||
return Client.CreateEntity(0, string.Empty, DateTime.Now, string.Empty, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<Client> ReadClients()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateClient(Client client)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Implementations;
|
||||
|
||||
public class DiscountRepository : IDiscountRepository
|
||||
{
|
||||
public void CreateDiscount(Discount discount)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteDiscount(int id)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Discount ReadDiscountById(int id)
|
||||
{
|
||||
return Discount.CreateEntity(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<Discount> ReadDiscounts()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateDiscount(Discount discount)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Implementations;
|
||||
|
||||
public class ReceiptRepository : IReceiptRepository
|
||||
{
|
||||
public void CreateReceipt(Receipt receipt)
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerable<Receipt> ReadReceipts(DateTime? dateFrom = null, DateTime? dateTo = null, int? clientId = null, int? tourId = null)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
35
project/ProjectTourAgency/Implementations/TourRepositiry.cs
Normal file
35
project/ProjectTourAgency/Implementations/TourRepositiry.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using ProjectTourAgency.Enities;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectTourAgency.Implementations;
|
||||
|
||||
public class TourRepositiry : ITourRepositiry
|
||||
{
|
||||
public void CreateTourt(Tour tour)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void DeleteTour(int id)
|
||||
{
|
||||
}
|
||||
|
||||
public Tour ReadTourById(int id)
|
||||
{
|
||||
return Tour.CreateEntity(0, string.Empty, DateTime.Now, string.Empty, 0);
|
||||
}
|
||||
|
||||
public IEnumerable<Tour> ReadTours()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public void UpdateTour(Tour tour)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,3 +1,7 @@
|
||||
using ProjectTourAgency.Implementations;
|
||||
using ProjectTourAgency.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectTourAgency
|
||||
{
|
||||
internal static class Program
|
||||
@ -11,7 +15,19 @@ namespace ProjectTourAgency
|
||||
// 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<FormTourAgency>());
|
||||
}
|
||||
|
||||
private static IUnityContainer CreateContainer()
|
||||
{
|
||||
var container = new UnityContainer();
|
||||
|
||||
container.RegisterType<IClientRepository, ClientRepository>();
|
||||
container.RegisterType<IDiscountRepository, DiscountRepository>();
|
||||
container.RegisterType<IReceiptRepository, ReceiptRepository>();
|
||||
container.RegisterType<ITourRepositiry, TourRepositiry>();
|
||||
|
||||
return container;
|
||||
}
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Implementations\" />
|
||||
<PackageReference Include="Unity" Version="5.11.10" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -11,7 +11,7 @@ public interface IDiscountRepository
|
||||
{
|
||||
IEnumerable<Discount> ReadDiscounts();
|
||||
|
||||
Client ReadDiscountById(int id);
|
||||
Discount ReadDiscountById(int id);
|
||||
|
||||
void CreateDiscount(Discount discount);
|
||||
void UpdateDiscount(Discount discount);
|
||||
|
@ -11,9 +11,10 @@ public interface ITourRepositiry
|
||||
{
|
||||
IEnumerable<Tour> ReadTours();
|
||||
|
||||
Client ReadTourById(int id);
|
||||
Tour ReadTourById(int id);
|
||||
|
||||
void CreateTourt(Tour tour);
|
||||
|
||||
void UpdateTour(Tour tour);
|
||||
|
||||
void DeleteTour(int id);
|
||||
|
Loading…
Reference in New Issue
Block a user