banana(hard)

This commit is contained in:
Your Name 2024-10-21 13:55:18 +03:00
parent efdaa78822
commit 62cf71e080
29 changed files with 201 additions and 31 deletions

View File

@ -34,7 +34,7 @@ namespace Demo.Data.Repository
return GetAllGroups[index];
}
public bool RemoveGroupById(int groupId)
public bool RemoveGroupByID(int groupId)
{
GroupLocalEntity? groupLocal = GetAllGroups
.Where(x => x.ID == groupId).FirstOrDefault();

View File

@ -5,7 +5,7 @@ namespace Demo.Data.Repository
public interface IGroupRepository
{
List<GroupLocalEntity> GetAllGroup();
bool RemoveGroupById(int groupId);
bool RemoveGroupByID(int groupId);
GroupLocalEntity? UpdateGroup(GroupLocalEntity updatedGroup);
GroupLocalEntity? GetGroupById(int groupId);
GroupLocalEntity? CreateGroup(GroupLocalEntity newGroup);

View File

@ -3,7 +3,7 @@ using Demo.Data.LocalData;
namespace Demo.Data.Repository
{
public class UserRepositoryImpl
public class UserRepositoryImpl : IUserRepository
{
public UserRepositoryImpl() {
@ -12,7 +12,7 @@ namespace Demo.Data.Repository
public List<UserLocalEntity> GetAllUsers
{ get; set; }
public List<UserLocalEntity> GeAllUser(){
public List<UserLocalEntity> GetAllUser(){
return GetAllUsers;
}

View File

@ -11,4 +11,8 @@
<Folder Include="Data\RemoteData\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
</ItemGroup>
</Project>

View File

@ -3,7 +3,7 @@ using Demo.Data.Repository;
namespace Demo.Domain.UseCase
{
public class GroupUseCase
public class GroupUseCase : IGroupUseCase
{
private readonly IUserRepository _repositoryUserImpl;
private readonly IGroupRepository _repositoryGroupImpl;
@ -16,7 +16,7 @@ namespace Demo.Domain.UseCase
public List<Group> GetAllGroups() => _repositoryGroupImpl.GetAllGroup()
.Select(it => new Group{ID = it.ID, Name = it.Name}).ToList();
public bool CreateNewGroup(Group group){
public bool CreateGroup(Group group){
GroupLocalEntity? groupLocalEntity = new GroupLocalEntity{ID = group.ID, Name = group.Name};
_repositoryGroupImpl.CreateGroup(groupLocalEntity);
if (groupLocalEntity != null) return false;
@ -42,8 +42,8 @@ namespace Demo.Domain.UseCase
};
}
public bool RemoveUserByGuid(Guid userGuid) {
return _repositoryUserImpl.RemoveUserByGuid(userGuid);
public bool RemoveGroupByID(int userID) {
return _repositoryGroupImpl.RemoveGroupByID(userID);
}
public Group GetGroupById(int groupID)

View File

@ -5,9 +5,9 @@ namespace Demo.Domain.UseCase
public interface IGroupUseCase
{
List<Group> GetAllGroups();
bool RemoveUserByGuid(Guid userGuid);
bool RemoveGroupByID(int groupID);
Group UpdateGroup(Group group);
GroupLocalEntity GetGroupById(int groupId);
Group GetGroupById(int groupID);
bool CreateGroup(Group group);
}
}

View File

@ -3,7 +3,7 @@ using Demo.Data.Repository;
namespace Demo.Domain.UseCase
{
public class UserUseCase
public class UserUseCase : IUserUseCase
{
private readonly IUserRepository _repositoryUserImpl;
private readonly IGroupRepository _repositoryGroupImpl;
@ -14,7 +14,7 @@ namespace Demo.Domain.UseCase
_repositoryUserImpl = repositoryUserImpl;
}
private List<Group> GetAllGroups() => _repositoryGroupImpl.GetAllGroup()
public List<Group> GetAllGroups() => _repositoryGroupImpl.GetAllGroup()
.Select(it => new Group{ID = it.ID, Name = it.Name}).ToList();
public List<User> GetAllUsers() => _repositoryUserImpl.GetAllUser()

View File

@ -1,10 +1,18 @@
using Demo.Data.Repository;
using Demo.Domain.UseCase;
using Demo.UI;
using Microsoft.Extensions.DependencyInjection;
GroupRepositoryImpl _groupRepositoryImpl = new GroupRepositoryImpl();
UserRepositoryImpl _userRepositoryImpl = new UserRepositoryImpl();
UserUseCase _userUseCase = new UserUseCase(_groupRepositoryImpl, _userRepositoryImpl);
GroupUseCase _groupUseCase = new GroupUseCase(_groupRepositoryImpl, _userRepositoryImpl);
IServiceCollection services = new ServiceCollection();
MainMenuUI mainMenuUI = new MainMenuUI(_userUseCase, _groupUseCase);
services
.AddSingleton<IGroupRepository, GroupRepositoryImpl>()
.AddSingleton<IUserRepository, UserRepositoryImpl>()
.AddSingleton<IGroupUseCase, GroupUseCase>()
.AddSingleton<IUserUseCase, UserUseCase>()
.AddSingleton<UserConsoleUI>()
.AddSingleton<MainMenuUI>();
var serviceProvider = services.BuildServiceProvider();
MainMenuUI? mainMenuUI = serviceProvider.GetService<MainMenuUI>();

View File

@ -9,7 +9,7 @@ namespace Demo.UI
UserConsoleUI _userConsoleUI;
GroupConsoleUI _groupConsoleUI;
public MainMenuUI(UserUseCase userUseCase, GroupUseCase groupUseCase) {
public MainMenuUI(IUserUseCase userUseCase, IGroupUseCase groupUseCase) {
_userConsoleUI = new UserConsoleUI(userUseCase);
_groupConsoleUI = new GroupConsoleUI(groupUseCase);
DisplayMenu();

View File

@ -6,8 +6,8 @@ namespace Demo.UI
{
public class UserConsoleUI
{
UserUseCase _userUseCase;
public UserConsoleUI(UserUseCase userUseCase) {
IUserUseCase _userUseCase;
public UserConsoleUI(IUserUseCase userUseCase) {
_userUseCase = userUseCase;
}
@ -52,8 +52,8 @@ namespace Demo.UI
public class GroupConsoleUI
{
GroupUseCase _groupUseCase;
public GroupConsoleUI(GroupUseCase groupUseCase){
IGroupUseCase _groupUseCase;
public GroupConsoleUI(IGroupUseCase groupUseCase){
_groupUseCase = groupUseCase;
}
@ -67,7 +67,7 @@ namespace Demo.UI
}
public void CreateNewGroup(Group group){
string output = _groupUseCase.CreateNewGroup(group) ? "Пользователь создан" : "Пользователь не создан";
string output = _groupUseCase.CreateGroup(group) ? "Пользователь создан" : "Пользователь не создан";
}
public void UpdateGroupName(Group group)

View File

@ -7,9 +7,31 @@
"targets": {
".NETCoreApp,Version=v8.0": {
"Demo/1.0.0": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "8.0.1"
},
"runtime": {
"Demo.dll": {}
}
},
"Microsoft.Extensions.DependencyInjection/8.0.1": {
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.2"
},
"runtime": {
"lib/net8.0/Microsoft.Extensions.DependencyInjection.dll": {
"assemblyVersion": "8.0.0.0",
"fileVersion": "8.0.1024.46610"
}
}
},
"Microsoft.Extensions.DependencyInjection.Abstractions/8.0.2": {
"runtime": {
"lib/net8.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {
"assemblyVersion": "8.0.0.0",
"fileVersion": "8.0.1024.46610"
}
}
}
}
},
@ -18,6 +40,20 @@
"type": "project",
"serviceable": false,
"sha512": ""
},
"Microsoft.Extensions.DependencyInjection/8.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-BmANAnR5Xd4Oqw7yQ75xOAYODybZQRzdeNucg7kS5wWKd2PNnMdYtJ2Vciy0QLylRmv42DGl5+AFL9izA6F1Rw==",
"path": "microsoft.extensions.dependencyinjection/8.0.1",
"hashPath": "microsoft.extensions.dependencyinjection.8.0.1.nupkg.sha512"
},
"Microsoft.Extensions.DependencyInjection.Abstractions/8.0.2": {
"type": "package",
"serviceable": true,
"sha512": "sha512-3iE7UF7MQkCv1cxzCahz+Y/guQbTqieyxyaWKhrRO91itI9cOKO76OHeQDahqG4MmW5umr3CcCvGmK92lWNlbg==",
"path": "microsoft.extensions.dependencyinjection.abstractions/8.0.2",
"hashPath": "microsoft.extensions.dependencyinjection.abstractions.8.0.2.nupkg.sha512"
}
}
}

Binary file not shown.

Binary file not shown.

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Demo")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+26da83afbacb32e0747365acef2fa22c2343aec8")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+efdaa788226f9fa951e2ae58165ff21fe7ad3343")]
[assembly: System.Reflection.AssemblyProductAttribute("Demo")]
[assembly: System.Reflection.AssemblyTitleAttribute("Demo")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
43ed596f37cf9f6f3388e175e6bccefd2309a85ded3d7b3c846b1dde41f188e3
48f599dad06dd9ec07676f26c2418560d03b7411954018e21ccf3036a6416f34

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
05407eb2645f69ef3210525c6e96fe1840a0c5f34e2e112238637ba9ea98449a
73b1ce81cd1614d1fb79d966e9c834dbbfe2456209fddcd2419a154a7bcb8cef

View File

@ -12,3 +12,7 @@
/Users/rinchi/VSCodeProjects/Demo/obj/Debug/net8.0/Demo.pdb
/Users/rinchi/VSCodeProjects/Demo/obj/Debug/net8.0/Demo.genruntimeconfig.cache
/Users/rinchi/VSCodeProjects/Demo/obj/Debug/net8.0/ref/Demo.dll
/Users/rinchi/VSCodeProjects/Demo/obj/Debug/net8.0/Demo.csproj.AssemblyReference.cache
/Users/rinchi/VSCodeProjects/Demo/bin/Debug/net8.0/Microsoft.Extensions.DependencyInjection.dll
/Users/rinchi/VSCodeProjects/Demo/bin/Debug/net8.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll
/Users/rinchi/VSCodeProjects/Demo/obj/Debug/net8.0/Demo.csproj.Up2Date

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -42,6 +42,12 @@
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"dependencies": {
"Microsoft.Extensions.DependencyInjection": {
"target": "Package",
"version": "[8.0.1, )"
}
},
"imports": [
"net461",
"net462",

View File

@ -1,11 +1,114 @@
{
"version": 3,
"targets": {
"net8.0": {}
"net8.0": {
"Microsoft.Extensions.DependencyInjection/8.0.1": {
"type": "package",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "8.0.2"
},
"compile": {
"lib/net8.0/Microsoft.Extensions.DependencyInjection.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net8.0/Microsoft.Extensions.DependencyInjection.dll": {
"related": ".xml"
}
},
"build": {
"buildTransitive/net6.0/_._": {}
}
},
"Microsoft.Extensions.DependencyInjection.Abstractions/8.0.2": {
"type": "package",
"compile": {
"lib/net8.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net8.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {
"related": ".xml"
}
},
"build": {
"buildTransitive/net6.0/_._": {}
}
}
}
},
"libraries": {
"Microsoft.Extensions.DependencyInjection/8.0.1": {
"sha512": "BmANAnR5Xd4Oqw7yQ75xOAYODybZQRzdeNucg7kS5wWKd2PNnMdYtJ2Vciy0QLylRmv42DGl5+AFL9izA6F1Rw==",
"type": "package",
"path": "microsoft.extensions.dependencyinjection/8.0.1",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"LICENSE.TXT",
"PACKAGE.md",
"THIRD-PARTY-NOTICES.TXT",
"buildTransitive/net461/Microsoft.Extensions.DependencyInjection.targets",
"buildTransitive/net462/_._",
"buildTransitive/net6.0/_._",
"buildTransitive/netcoreapp2.0/Microsoft.Extensions.DependencyInjection.targets",
"lib/net462/Microsoft.Extensions.DependencyInjection.dll",
"lib/net462/Microsoft.Extensions.DependencyInjection.xml",
"lib/net6.0/Microsoft.Extensions.DependencyInjection.dll",
"lib/net6.0/Microsoft.Extensions.DependencyInjection.xml",
"lib/net7.0/Microsoft.Extensions.DependencyInjection.dll",
"lib/net7.0/Microsoft.Extensions.DependencyInjection.xml",
"lib/net8.0/Microsoft.Extensions.DependencyInjection.dll",
"lib/net8.0/Microsoft.Extensions.DependencyInjection.xml",
"lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.dll",
"lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.xml",
"lib/netstandard2.1/Microsoft.Extensions.DependencyInjection.dll",
"lib/netstandard2.1/Microsoft.Extensions.DependencyInjection.xml",
"microsoft.extensions.dependencyinjection.8.0.1.nupkg.sha512",
"microsoft.extensions.dependencyinjection.nuspec",
"useSharedDesignerContext.txt"
]
},
"Microsoft.Extensions.DependencyInjection.Abstractions/8.0.2": {
"sha512": "3iE7UF7MQkCv1cxzCahz+Y/guQbTqieyxyaWKhrRO91itI9cOKO76OHeQDahqG4MmW5umr3CcCvGmK92lWNlbg==",
"type": "package",
"path": "microsoft.extensions.dependencyinjection.abstractions/8.0.2",
"files": [
".nupkg.metadata",
".signature.p7s",
"Icon.png",
"LICENSE.TXT",
"PACKAGE.md",
"THIRD-PARTY-NOTICES.TXT",
"buildTransitive/net461/Microsoft.Extensions.DependencyInjection.Abstractions.targets",
"buildTransitive/net462/_._",
"buildTransitive/net6.0/_._",
"buildTransitive/netcoreapp2.0/Microsoft.Extensions.DependencyInjection.Abstractions.targets",
"lib/net462/Microsoft.Extensions.DependencyInjection.Abstractions.dll",
"lib/net462/Microsoft.Extensions.DependencyInjection.Abstractions.xml",
"lib/net6.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll",
"lib/net6.0/Microsoft.Extensions.DependencyInjection.Abstractions.xml",
"lib/net7.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll",
"lib/net7.0/Microsoft.Extensions.DependencyInjection.Abstractions.xml",
"lib/net8.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll",
"lib/net8.0/Microsoft.Extensions.DependencyInjection.Abstractions.xml",
"lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll",
"lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.xml",
"lib/netstandard2.1/Microsoft.Extensions.DependencyInjection.Abstractions.dll",
"lib/netstandard2.1/Microsoft.Extensions.DependencyInjection.Abstractions.xml",
"microsoft.extensions.dependencyinjection.abstractions.8.0.2.nupkg.sha512",
"microsoft.extensions.dependencyinjection.abstractions.nuspec",
"useSharedDesignerContext.txt"
]
}
},
"libraries": {},
"projectFileDependencyGroups": {
"net8.0": []
"net8.0": [
"Microsoft.Extensions.DependencyInjection >= 8.0.1"
]
},
"packageFolders": {
"/Users/rinchi/.nuget/packages/": {}
@ -48,6 +151,12 @@
"frameworks": {
"net8.0": {
"targetAlias": "net8.0",
"dependencies": {
"Microsoft.Extensions.DependencyInjection": {
"target": "Package",
"version": "[8.0.1, )"
}
},
"imports": [
"net461",
"net462",

View File

@ -1,8 +1,11 @@
{
"version": 2,
"dgSpecHash": "cqUSRourbns=",
"dgSpecHash": "CV56+lALKGE=",
"success": true,
"projectFilePath": "/Users/rinchi/VSCodeProjects/Demo/Demo.csproj",
"expectedPackageFiles": [],
"expectedPackageFiles": [
"/Users/rinchi/.nuget/packages/microsoft.extensions.dependencyinjection/8.0.1/microsoft.extensions.dependencyinjection.8.0.1.nupkg.sha512",
"/Users/rinchi/.nuget/packages/microsoft.extensions.dependencyinjection.abstractions/8.0.2/microsoft.extensions.dependencyinjection.abstractions.8.0.2.nupkg.sha512"
],
"logs": []
}