add IGroupRepository.cs
This commit is contained in:
parent
685c86d2ec
commit
eb85148c58
BIN
.vs/Demo/DesignTimeBuild/.dtbcache.v2
Normal file
BIN
.vs/Demo/DesignTimeBuild/.dtbcache.v2
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.vs/Demo/v17/.futdcache.v2
Normal file
BIN
.vs/Demo/v17/.futdcache.v2
Normal file
Binary file not shown.
BIN
.vs/Demo/v17/.suo
Normal file
BIN
.vs/Demo/v17/.suo
Normal file
Binary file not shown.
91
.vs/Demo/v17/DocumentLayout.backup.json
Normal file
91
.vs/Demo/v17/DocumentLayout.backup.json
Normal file
@ -0,0 +1,91 @@
|
||||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{983820F6-FF31-4B3A-8593-831BC3904E80}|Demo\\Demo.csproj|c:\\users\\vivobook 15x\\desktop\\presencenikita\\demo\\domain\\usecase\\groupusecase.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{983820F6-FF31-4B3A-8593-831BC3904E80}|Demo\\Demo.csproj|solutionrelative:demo\\domain\\usecase\\groupusecase.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{983820F6-FF31-4B3A-8593-831BC3904E80}|Demo\\Demo.csproj|c:\\users\\vivobook 15x\\desktop\\presencenikita\\demo\\ui\\mainmenu.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{983820F6-FF31-4B3A-8593-831BC3904E80}|Demo\\Demo.csproj|solutionrelative:demo\\ui\\mainmenu.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{983820F6-FF31-4B3A-8593-831BC3904E80}|Demo\\Demo.csproj|c:\\users\\vivobook 15x\\desktop\\presencenikita\\demo\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{983820F6-FF31-4B3A-8593-831BC3904E80}|Demo\\Demo.csproj|solutionrelative:demo\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{983820F6-FF31-4B3A-8593-831BC3904E80}|Demo\\Demo.csproj|c:\\users\\vivobook 15x\\desktop\\presencenikita\\demo\\ui\\userconsole.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{983820F6-FF31-4B3A-8593-831BC3904E80}|Demo\\Demo.csproj|solutionrelative:demo\\ui\\userconsole.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 1,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "GroupUseCase.cs",
|
||||
"DocumentMoniker": "C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\Demo\\Domain\\UseCase\\GroupUseCase.cs",
|
||||
"RelativeDocumentMoniker": "Demo\\Domain\\UseCase\\GroupUseCase.cs",
|
||||
"ToolTip": "C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\Demo\\Domain\\UseCase\\GroupUseCase.cs",
|
||||
"RelativeToolTip": "Demo\\Domain\\UseCase\\GroupUseCase.cs",
|
||||
"ViewState": "AgIAAA8AAAAAAAAAAAAAABcAAAAJAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-10-19T09:31:57.007Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"Title": "UserConsole.cs",
|
||||
"DocumentMoniker": "C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\Demo\\UI\\UserConsole.cs",
|
||||
"RelativeDocumentMoniker": "Demo\\UI\\UserConsole.cs",
|
||||
"ToolTip": "C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\Demo\\UI\\UserConsole.cs",
|
||||
"RelativeToolTip": "Demo\\UI\\UserConsole.cs",
|
||||
"ViewState": "AgIAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-10-18T17:18:21.523Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "Program.cs",
|
||||
"DocumentMoniker": "C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\Demo\\Program.cs",
|
||||
"RelativeDocumentMoniker": "Demo\\Program.cs",
|
||||
"ToolTip": "C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\Demo\\Program.cs",
|
||||
"RelativeToolTip": "Demo\\Program.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAoAAAAzAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-10-18T17:06:32.786Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "MainMenu.cs",
|
||||
"DocumentMoniker": "C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\Demo\\UI\\MainMenu.cs",
|
||||
"RelativeDocumentMoniker": "Demo\\UI\\MainMenu.cs",
|
||||
"ToolTip": "C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\Demo\\UI\\MainMenu.cs",
|
||||
"RelativeToolTip": "Demo\\UI\\MainMenu.cs",
|
||||
"ViewState": "AgIAAAoAAAAAAAAAAAAuwBQAAAA/AAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-10-18T17:07:42.66Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
23
.vs/Demo/v17/DocumentLayout.json
Normal file
23
.vs/Demo/v17/DocumentLayout.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\",
|
||||
"Documents": [],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": -1,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
BIN
.vs/ProjectEvaluation/demo.metadata.v9.bin
Normal file
BIN
.vs/ProjectEvaluation/demo.metadata.v9.bin
Normal file
Binary file not shown.
BIN
.vs/ProjectEvaluation/demo.projects.v9.bin
Normal file
BIN
.vs/ProjectEvaluation/demo.projects.v9.bin
Normal file
Binary file not shown.
BIN
.vs/ProjectEvaluation/demo.strings.v9.bin
Normal file
BIN
.vs/ProjectEvaluation/demo.strings.v9.bin
Normal file
Binary file not shown.
@ -13,7 +13,7 @@ namespace Demo.domain.Models
|
||||
|
||||
public required int GroupID { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
public bool Equals(UserLocalEnity? other)
|
||||
{
|
||||
@ -22,3 +22,4 @@ namespace Demo.domain.Models
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,12 +4,38 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Demo.Data.Repository
|
||||
{
|
||||
public class GroupRepositoryImpl
|
||||
public class GroupRepositoryImpl : IGroupRepository
|
||||
{
|
||||
public List<GroupLocalEntity> GetAllGroups() => LocalStaticData.groups;
|
||||
public bool AddGroup(GroupLocalEntity newGroup)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<GroupLocalEntity> GetAllGroup()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<GroupLocalEntity> GetAllGroups() => LocalStaticData.groups;
|
||||
|
||||
public GroupLocalEntity GetGroupById(int groupID)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool RemoveGroupById(int groupID)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool UpdateGroupById(int groupID, GroupLocalEntity updatedGroup)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
18
Demo/Data/Repository/IGroupRepository.cs
Normal file
18
Demo/Data/Repository/IGroupRepository.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using Demo.domain.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Demo.Data.Repository
|
||||
{
|
||||
public interface IGroupRepository
|
||||
{
|
||||
List<GroupLocalEntity> GetAllGroup();
|
||||
bool RemoveGroupById(int groupID);
|
||||
bool UpdateGroupById(int groupID, GroupLocalEntity updatedGroup);
|
||||
GroupLocalEntity GetGroupById(int groupID);
|
||||
bool AddGroup(GroupLocalEntity newGroup);
|
||||
}
|
||||
}
|
@ -10,19 +10,20 @@ namespace Demo.Domain.UseCase
|
||||
{
|
||||
public class UserUseCase
|
||||
{
|
||||
private UserRepositoryImpl _repositoryUserImpl;
|
||||
private GroupRepositoryImpl _repositoryGroupImpl;
|
||||
private readonly UserRepositoryImpl _repositoryUserImpl;
|
||||
private readonly IGroupRepository _repositoryGroupImpl;
|
||||
|
||||
public UserUseCase(UserRepositoryImpl repositoryImpl, GroupRepositoryImpl repositoryGroupImpl)
|
||||
public UserUseCase(UserRepositoryImpl repositoryImpl, IGroupRepository repositoryGroupImpl)
|
||||
{
|
||||
_repositoryUserImpl = repositoryImpl;
|
||||
_repositoryGroupImpl = repositoryGroupImpl;
|
||||
}
|
||||
|
||||
public List<Group> GetAllGroups() => _repositoryGroupImpl.GetAllGroups()
|
||||
private List<Group> GetAllGroups() => _repositoryGroupImpl.GetAllGroup()
|
||||
.Select(it => new Group { Id = it.Id, Name = it.Name }).ToList();
|
||||
|
||||
public List<User> GetAllUsers() => _repositoryUserImpl.GetAllUsers
|
||||
.Join(_repositoryGroupImpl.GetAllGroups(),
|
||||
.Join(_repositoryGroupImpl.GetAllGroup(),
|
||||
user => user.GroupID,
|
||||
group => group.Id,
|
||||
(user, group) =>
|
||||
@ -67,7 +68,7 @@ namespace Demo.Domain.UseCase
|
||||
.FirstOrDefault(u => u.Guid == userGuid);
|
||||
if (user == null) throw new Exception("Пользователь не найден");
|
||||
|
||||
var group = _repositoryGroupImpl.GetAllGroups()
|
||||
var group = _repositoryGroupImpl.GetAllGroup()
|
||||
.FirstOrDefault(g => g.Id == user.GroupID);
|
||||
|
||||
return new User
|
||||
|
@ -3,6 +3,8 @@ using Demo.Data.Repository;
|
||||
using Demo.Domain.UseCase;
|
||||
using Demo.UI;
|
||||
|
||||
|
||||
|
||||
GroupRepositoryImpl groupRepositoryImpl = new GroupRepositoryImpl();
|
||||
UserRepositoryImpl userRepositoryImpl = new UserRepositoryImpl();
|
||||
UserUseCase userUseCase = new UserUseCase(userRepositoryImpl, groupRepositoryImpl);
|
||||
|
@ -42,7 +42,7 @@ namespace Demo.UI
|
||||
|
||||
// удалить пользователя по guid
|
||||
case 2:
|
||||
Console.Write("Введите имя пользователя: ");
|
||||
Console.Write("Введите guid пользователя: ");
|
||||
_userConsoleUI.RemoveUserByGuid(Guid.Parse(Console.ReadLine()));
|
||||
break;
|
||||
|
||||
|
@ -15,10 +15,11 @@ namespace Demo.UI
|
||||
_userUseCase = userUseCase;
|
||||
}
|
||||
|
||||
public void RemoveUserByGuid(Guid guidUser) {
|
||||
public void RemoveUserByGuid(Guid guidUser)
|
||||
{
|
||||
|
||||
string del = _userUseCase.RemoveUserByGuid(guidUser) ? "Пользователь удален" : "Пользователь не удален";
|
||||
Console.WriteLine(del);
|
||||
string output = _userUseCase.RemoveUserByGuid(guidUser) ? "Пользователь удален" : "Пользователь не удален";
|
||||
Console.WriteLine(output);
|
||||
}
|
||||
|
||||
public void DisplayAllUsers()
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -14,7 +14,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+450363bfcbd9d1181b9f9603d2b5a88ef23421f1")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+685c86d2ec0c7fc11e7d69b1d6f6e4616173b7a3")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Demo")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Demo")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
@ -1 +1 @@
|
||||
82398f8776110354e0284895ebb0d7b632952ab8604f29b3eaf202a9b9454f32
|
||||
3f2e0074bb47c317bee9bc70ebedb92521800139988cb3eea2c3cce057f7c42e
|
||||
|
@ -1 +1 @@
|
||||
eff918b7fd1dc49f37ad0c036085f5a6ea63aec8d1d02ffa6a34a0e6ea70a8b3
|
||||
2fd5302764dc9381aee037b8a9d299528ab55aa4f77f64c12a39c0fab6427860
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,17 +1,17 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"C:\\Users\\VivoBook 15X\\Desktop\\C#\\Программные модули\\presence\\Demo\\Demo.csproj": {}
|
||||
"C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\Demo\\Demo.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"C:\\Users\\VivoBook 15X\\Desktop\\C#\\Программные модули\\presence\\Demo\\Demo.csproj": {
|
||||
"C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\Demo\\Demo.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\VivoBook 15X\\Desktop\\C#\\Программные модули\\presence\\Demo\\Demo.csproj",
|
||||
"projectUniqueName": "C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\Demo\\Demo.csproj",
|
||||
"projectName": "Demo",
|
||||
"projectPath": "C:\\Users\\VivoBook 15X\\Desktop\\C#\\Программные модули\\presence\\Demo\\Demo.csproj",
|
||||
"projectPath": "C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\Demo\\Demo.csproj",
|
||||
"packagesPath": "C:\\Users\\VivoBook 15X\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\VivoBook 15X\\Desktop\\C#\\Программные модули\\presence\\Demo\\obj\\",
|
||||
"outputPath": "C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\Demo\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\VivoBook 15X\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
|
@ -13,11 +13,11 @@
|
||||
"project": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "C:\\Users\\VivoBook 15X\\Desktop\\C#\\Программные модули\\presence\\Demo\\Demo.csproj",
|
||||
"projectUniqueName": "C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\Demo\\Demo.csproj",
|
||||
"projectName": "Demo",
|
||||
"projectPath": "C:\\Users\\VivoBook 15X\\Desktop\\C#\\Программные модули\\presence\\Demo\\Demo.csproj",
|
||||
"projectPath": "C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\Demo\\Demo.csproj",
|
||||
"packagesPath": "C:\\Users\\VivoBook 15X\\.nuget\\packages\\",
|
||||
"outputPath": "C:\\Users\\VivoBook 15X\\Desktop\\C#\\Программные модули\\presence\\Demo\\obj\\",
|
||||
"outputPath": "C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\Demo\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\VivoBook 15X\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "IkHy/mnznvI=",
|
||||
"dgSpecHash": "pcEnCc6PhG4=",
|
||||
"success": true,
|
||||
"projectFilePath": "C:\\Users\\VivoBook 15X\\Desktop\\C#\\Программные модули\\presence\\Demo\\Demo.csproj",
|
||||
"projectFilePath": "C:\\Users\\VivoBook 15X\\Desktop\\presenceNikita\\Demo\\Demo.csproj",
|
||||
"expectedPackageFiles": [],
|
||||
"logs": []
|
||||
}
|
Loading…
Reference in New Issue
Block a user