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