32 lines
737 B
C#
32 lines
737 B
C#
using console_ui;
|
|
using data;
|
|
using data.Repository;
|
|
using domain.Service;
|
|
using domain.UseCase;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
void printAllGroups(IGroupRepository groupRepository)
|
|
{
|
|
foreach (var item in groupRepository.getAllGroup())
|
|
{
|
|
Console.WriteLine($"{item.Id} {item.Name}");
|
|
}
|
|
}
|
|
|
|
IServiceCollection serviceCollection = new ServiceCollection();
|
|
|
|
serviceCollection
|
|
.AddDbContext<RemoteDatabaseContext>()
|
|
.AddSingleton<IGroupRepository, SQLGroupRepository>()
|
|
.AddSingleton<IGroupUseCase, GroupService>()
|
|
.AddSingleton<GroupUI>();
|
|
|
|
|
|
var serivceProvider = serviceCollection.BuildServiceProvider();
|
|
|
|
var groupUi = serivceProvider.GetService<GroupUI>();
|
|
|
|
groupUi?.AddGroup();
|
|
|
|
|