first commit
This commit is contained in:
commit
d5ff9f45a5
BIN
Data/.DS_Store
vendored
Normal file
BIN
Data/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
Data/LocalData/.DS_Store
vendored
Normal file
BIN
Data/LocalData/.DS_Store
vendored
Normal file
Binary file not shown.
8
Data/LocalData/Entity/Group.cs
Normal file
8
Data/LocalData/Entity/Group.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
namespace Demo.Domain.Models
|
||||||
|
{
|
||||||
|
public class GroupLocalEntity
|
||||||
|
{
|
||||||
|
public required int ID {get; set; }
|
||||||
|
public required string Name{get; set; }
|
||||||
|
}
|
||||||
|
}
|
9
Data/LocalData/Entity/Presence.cs
Normal file
9
Data/LocalData/Entity/Presence.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
namespace Demo.Domain.Models{
|
||||||
|
public class PresenceLocalEntity{
|
||||||
|
public required Guid UserGuid{get; set; }
|
||||||
|
public bool IsAttedance { get; set; } = true;
|
||||||
|
public required DateOnly Date { get; set; }
|
||||||
|
|
||||||
|
public required int LessonNumber { get; set; }
|
||||||
|
}
|
||||||
|
}
|
13
Data/LocalData/Entity/User.cs
Normal file
13
Data/LocalData/Entity/User.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
namespace Demo.Domain.Models{
|
||||||
|
public class UserLocalEntity{
|
||||||
|
public required string FIO{get; set; }
|
||||||
|
public Guid Guid {get; set; }
|
||||||
|
public required int GroupID{get; set; }
|
||||||
|
|
||||||
|
public bool Equals(UserLocalEntity? other)
|
||||||
|
{
|
||||||
|
if (other == null) return false;
|
||||||
|
return this.Guid.Equals(other.Guid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
Data/LocalData/LocalStaticData.cs
Normal file
24
Data/LocalData/LocalStaticData.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using Demo.Domain.Models;
|
||||||
|
|
||||||
|
namespace Demo.Data.LocalData
|
||||||
|
{
|
||||||
|
public class LocalStaticData
|
||||||
|
{
|
||||||
|
public static List<GroupLocalEntity> groups => new List<GroupLocalEntity>
|
||||||
|
{
|
||||||
|
new GroupLocalEntity{ID = 1, Name = "ИП1-21"},
|
||||||
|
new GroupLocalEntity{ID = 2, Name = "ИП1-22"},
|
||||||
|
new GroupLocalEntity{ID = 3, Name = "ИП1-23"},
|
||||||
|
};
|
||||||
|
|
||||||
|
public static List<UserLocalEntity> users => new List<UserLocalEntity>
|
||||||
|
{
|
||||||
|
new UserLocalEntity{Guid=Guid.Parse("e6b9964d-ea9f-420a-84b9-af9633bbfab9"), FIO = "RandomFio", GroupID = 1 },
|
||||||
|
new UserLocalEntity{Guid=Guid.Parse("8388d931-5bef-41be-a152-78f1aca980ed"), FIO = "RandomFio1", GroupID = 2 },
|
||||||
|
new UserLocalEntity{Guid=Guid.Parse("ed174548-49ed-4503-a902-c970cbf27173"), FIO = "RandomFio2", GroupID = 3 },
|
||||||
|
new UserLocalEntity{Guid=Guid.Parse("614c0a23-5bd5-43ae-b48e-d5750afbc282"), FIO = "RandomFio3", GroupID = 1 },
|
||||||
|
new UserLocalEntity{Guid=Guid.Parse("efcc1473-c116-4244-b3f7-f2341a5c3003"), FIO = "RandomFio4", GroupID = 2 },
|
||||||
|
new UserLocalEntity{Guid=Guid.Parse("60640fb3-ace2-4cad-81d5-a0a58bc2dbbd"), FIO = "RandomFio5", GroupID = 3 },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
31
Data/Repository/GroupRepositoryImpl.cs
Normal file
31
Data/Repository/GroupRepositoryImpl.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
using Demo.Domain.Models;
|
||||||
|
|
||||||
|
using Demo.Data.LocalData;
|
||||||
|
|
||||||
|
namespace Demo.Data.Repository
|
||||||
|
{
|
||||||
|
public class GroupRepositoryImpl
|
||||||
|
{
|
||||||
|
// public List<GroupLocalEntity> GetAllGroups() => LocalStaticData.groups;
|
||||||
|
public GroupRepositoryImpl() {
|
||||||
|
|
||||||
|
GetAllGroups = LocalStaticData.groups;
|
||||||
|
}
|
||||||
|
public List<GroupLocalEntity> GetAllGroups
|
||||||
|
{ get; set; }
|
||||||
|
|
||||||
|
public void CreateNewGroup(GroupLocalEntity groupLocalEntity)
|
||||||
|
{
|
||||||
|
GetAllGroups.Add(groupLocalEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupLocalEntity? UpdateUserById(GroupLocalEntity groupUpdateLocalEntity)
|
||||||
|
{
|
||||||
|
int index = GetAllGroups.FindIndex(x => x.ID == groupUpdateLocalEntity.ID);
|
||||||
|
if (index == -1) return null;
|
||||||
|
GetAllGroups[index].Name = groupUpdateLocalEntity.Name;
|
||||||
|
Console.WriteLine($"Обновленный Name: {GetAllGroups[index].Name}");
|
||||||
|
return GetAllGroups[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
42
Data/Repository/UserRepositorylmpl.cs
Normal file
42
Data/Repository/UserRepositorylmpl.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using Demo.Domain.Models;
|
||||||
|
using Demo.Data.LocalData;
|
||||||
|
|
||||||
|
namespace Demo.Data.Repository
|
||||||
|
{
|
||||||
|
public class UserRepositoryImpl
|
||||||
|
{
|
||||||
|
public UserRepositoryImpl() {
|
||||||
|
|
||||||
|
GetAllUsers = LocalStaticData.users;
|
||||||
|
}
|
||||||
|
public List<UserLocalEntity> GetAllUsers
|
||||||
|
{ get; set; }
|
||||||
|
|
||||||
|
public bool RemoveUserByGuid(Guid userGuid)
|
||||||
|
{
|
||||||
|
UserLocalEntity? userLocal = GetAllUsers
|
||||||
|
.Where(x => x.Guid == userGuid).FirstOrDefault();
|
||||||
|
if (userLocal == null) return false;
|
||||||
|
|
||||||
|
return GetAllUsers.Remove(userLocal);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserLocalEntity? GetUserById(Guid userGuid)
|
||||||
|
{
|
||||||
|
UserLocalEntity? userlocal = LocalStaticData.users.Where(x => x.Guid == userGuid).FirstOrDefault();
|
||||||
|
if (userlocal == null) return null;
|
||||||
|
|
||||||
|
return userlocal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserLocalEntity? UpdateUserById(UserLocalEntity userUpdateLocalEntity)
|
||||||
|
{
|
||||||
|
int index = GetAllUsers.FindIndex(x => x.Guid == userUpdateLocalEntity.Guid);
|
||||||
|
if (index == -1) return null;
|
||||||
|
GetAllUsers[index].FIO = userUpdateLocalEntity.FIO;
|
||||||
|
GetAllUsers[index].GroupID = userUpdateLocalEntity.GroupID;
|
||||||
|
Console.WriteLine($"Обновленный FIO: {GetAllUsers[index].FIO}, GroupID: {GetAllUsers[index].GroupID}");
|
||||||
|
return GetAllUsers[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
Demo.csproj
Normal file
14
Demo.csproj
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Data\RemoteData\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
25
Demo.sln
Normal file
25
Demo.sln
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.5.002.0
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Demo", "Demo.csproj", "{6C8DBC83-21F3-4474-A890-891D55757805}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{6C8DBC83-21F3-4474-A890-891D55757805}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{6C8DBC83-21F3-4474-A890-891D55757805}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{6C8DBC83-21F3-4474-A890-891D55757805}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{6C8DBC83-21F3-4474-A890-891D55757805}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {A18C0E44-3015-47E6-8F69-B8ACD1677185}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
13
Domain/Models/Group.cs
Normal file
13
Domain/Models/Group.cs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
namespace Demo.Domain.Models
|
||||||
|
{
|
||||||
|
public class Group
|
||||||
|
{
|
||||||
|
public required int ID{get; set; }
|
||||||
|
public required string Name{get; set; }
|
||||||
|
|
||||||
|
public static Group Parse(string input){
|
||||||
|
string[] words = input.Split(" ");
|
||||||
|
return new Group{ID = Convert.ToInt32(words[0]), Name = words[1]};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Domain/Models/Presence.cs
Normal file
11
Domain/Models/Presence.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
namespace Demo.Domain.Models
|
||||||
|
{
|
||||||
|
public class Presence
|
||||||
|
{
|
||||||
|
public required User User{get; set; }
|
||||||
|
public bool IsAttedance { get; set; } = true;
|
||||||
|
public required DateOnly Date { get; set; }
|
||||||
|
|
||||||
|
public required int LessonNumber { get; set; }
|
||||||
|
}
|
||||||
|
}
|
27
Domain/Models/User.cs
Normal file
27
Domain/Models/User.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
namespace Demo.Domain.Models
|
||||||
|
{
|
||||||
|
public class User
|
||||||
|
{
|
||||||
|
public required string FIO{get; set; }
|
||||||
|
public Guid Guid{get; set; }
|
||||||
|
public required Group Group{get; set; }
|
||||||
|
|
||||||
|
public static User Parse(string input){
|
||||||
|
string[] words = input.Split(" ");
|
||||||
|
// return new Group{ID = Convert.ToInt32(words[0]), Name = words[1]};
|
||||||
|
foreach (string element in words){
|
||||||
|
Console.Write(element + " ");
|
||||||
|
}
|
||||||
|
return new User
|
||||||
|
{
|
||||||
|
FIO = words[0],
|
||||||
|
Guid = Guid.Parse(words[1]),
|
||||||
|
Group = new Group
|
||||||
|
{
|
||||||
|
ID = Convert.ToInt32(words[2]),
|
||||||
|
Name = words[3]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
Domain/UseCase/GroupUseCase.cs
Normal file
45
Domain/UseCase/GroupUseCase.cs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
using Demo.Domain.Models;
|
||||||
|
using Demo.Data.Repository;
|
||||||
|
|
||||||
|
namespace Demo.Domain.UseCase
|
||||||
|
{
|
||||||
|
public class GroupUseCase
|
||||||
|
{
|
||||||
|
private GroupRepositoryImpl _repositoryGroupImpl;
|
||||||
|
private UserRepositoryImpl _repositoryUserImpl;
|
||||||
|
public GroupUseCase(GroupRepositoryImpl repositoryGroupImpl, UserRepositoryImpl repositoryUserImpl)
|
||||||
|
{
|
||||||
|
_repositoryGroupImpl = repositoryGroupImpl;
|
||||||
|
_repositoryUserImpl = repositoryUserImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Group> GetAllGroups() => _repositoryGroupImpl.GetAllGroups
|
||||||
|
.Select(it => new Group{ID = it.ID, Name = it.Name}).ToList();
|
||||||
|
|
||||||
|
public bool CreateNewGroup(Group group){
|
||||||
|
GroupLocalEntity? groupLocalEntity = new GroupLocalEntity{ID = group.ID, Name = group.Name};
|
||||||
|
_repositoryGroupImpl.CreateNewGroup(groupLocalEntity);
|
||||||
|
if (groupLocalEntity != null) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Group UpdateUser(Group group)
|
||||||
|
{
|
||||||
|
GroupLocalEntity groupLocalEntity = new GroupLocalEntity
|
||||||
|
{
|
||||||
|
ID = group.ID,
|
||||||
|
Name = group.Name
|
||||||
|
};
|
||||||
|
GroupLocalEntity? result = _repositoryGroupImpl.UpdateUserById(groupLocalEntity);
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Не удалось обновить пользователя: пользователь не найден.");
|
||||||
|
}
|
||||||
|
return new Group
|
||||||
|
{
|
||||||
|
ID = result.ID,
|
||||||
|
Name = result.Name
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
77
Domain/UseCase/UserUseCase.cs
Normal file
77
Domain/UseCase/UserUseCase.cs
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
using Demo.Domain.Models;
|
||||||
|
using Demo.Data.Repository;
|
||||||
|
|
||||||
|
namespace Demo.Domain.UseCase
|
||||||
|
{
|
||||||
|
public class UserUseCase
|
||||||
|
{
|
||||||
|
private GroupRepositoryImpl _repositoryGroupImpl;
|
||||||
|
private UserRepositoryImpl _repositoryUserImpl;
|
||||||
|
|
||||||
|
public UserUseCase(GroupRepositoryImpl repositoryGroupImpl, UserRepositoryImpl repositoryUserImpl)
|
||||||
|
{
|
||||||
|
_repositoryGroupImpl = repositoryGroupImpl;
|
||||||
|
_repositoryUserImpl = repositoryUserImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Group> GetAllGroups() => _repositoryGroupImpl.GetAllGroups
|
||||||
|
.Select(it => new Group{ID = it.ID, Name = it.Name}).ToList();
|
||||||
|
|
||||||
|
public List<User> GetAllUsers() => _repositoryUserImpl.GetAllUsers
|
||||||
|
.Join(_repositoryGroupImpl.GetAllGroups,
|
||||||
|
user => user.GroupID,
|
||||||
|
group => group.ID,
|
||||||
|
(user, group) => new User{
|
||||||
|
FIO = user.FIO,
|
||||||
|
Guid = user.Guid,
|
||||||
|
Group = new Group{
|
||||||
|
ID = group.ID,
|
||||||
|
Name = group.Name}
|
||||||
|
}
|
||||||
|
).ToList();
|
||||||
|
|
||||||
|
public User GetUserByGuid(Guid userGuid){
|
||||||
|
UserLocalEntity? userLocalEntity = _repositoryUserImpl.GetUserById(userGuid);
|
||||||
|
if (userLocalEntity == null) throw new Exception("bello");
|
||||||
|
Group? group = GetAllGroups().FirstOrDefault(it => userLocalEntity.GroupID == it.ID);
|
||||||
|
if (group == null) throw new Exception("bello");
|
||||||
|
return new User{
|
||||||
|
FIO = userLocalEntity.FIO,
|
||||||
|
Guid = userLocalEntity.Guid,
|
||||||
|
Group = new Group{
|
||||||
|
ID = group.ID,
|
||||||
|
Name = group.Name}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool RemoveUserByGuid(Guid userGuid) {
|
||||||
|
return _repositoryUserImpl.RemoveUserByGuid(userGuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public User UpdateUser(User user)
|
||||||
|
{
|
||||||
|
UserLocalEntity userLocalEntity = new UserLocalEntity
|
||||||
|
{
|
||||||
|
FIO = user.FIO,
|
||||||
|
Guid = user.Guid,
|
||||||
|
GroupID = user.Group.ID
|
||||||
|
};
|
||||||
|
UserLocalEntity? result = _repositoryUserImpl.UpdateUserById(userLocalEntity);
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Не удалось обновить пользователя: пользователь не найден.");
|
||||||
|
}
|
||||||
|
Group? group = GetAllGroups().FirstOrDefault(it => result.GroupID == it.ID);
|
||||||
|
if (group == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Не удалось обновить пользователя: группа не найдена.");
|
||||||
|
}
|
||||||
|
return new User
|
||||||
|
{
|
||||||
|
FIO = result.FIO,
|
||||||
|
Guid = result.Guid,
|
||||||
|
Group = group
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
10
Program.cs
Normal file
10
Program.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using Demo.Data.Repository;
|
||||||
|
using Demo.Domain.UseCase;
|
||||||
|
using Demo.UI;
|
||||||
|
|
||||||
|
GroupRepositoryImpl _groupRepositoryImpl = new GroupRepositoryImpl();
|
||||||
|
UserRepositoryImpl _userRepositoryImpl = new UserRepositoryImpl();
|
||||||
|
UserUseCase _userUseCase = new UserUseCase(_groupRepositoryImpl, _userRepositoryImpl);
|
||||||
|
GroupUseCase _groupUseCase = new GroupUseCase(_groupRepositoryImpl, _userRepositoryImpl);
|
||||||
|
|
||||||
|
MainMenuUI mainMenuUI = new MainMenuUI(_userUseCase, _groupUseCase);
|
39
UI/MainMenu.cs
Normal file
39
UI/MainMenu.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
using Demo.Domain.Models;
|
||||||
|
using Demo.Domain.UseCase;
|
||||||
|
|
||||||
|
namespace Demo.UI
|
||||||
|
{
|
||||||
|
public class MainMenuUI
|
||||||
|
{
|
||||||
|
|
||||||
|
UserConsoleUI _userConsoleUI;
|
||||||
|
GroupConsoleUI _groupConsoleUI;
|
||||||
|
|
||||||
|
public MainMenuUI(UserUseCase userUseCase, GroupUseCase groupUseCase) {
|
||||||
|
_userConsoleUI = new UserConsoleUI(userUseCase);
|
||||||
|
_groupConsoleUI = new GroupConsoleUI(groupUseCase);
|
||||||
|
DisplayMenu();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DisplayMenu() {
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
switch (Console.ReadLine())
|
||||||
|
{
|
||||||
|
case "1": _userConsoleUI.DisplayAllUsers(); break;
|
||||||
|
case "2": _userConsoleUI.RemoveUserByGuid(Guid.Parse(Console.ReadLine())); break;
|
||||||
|
case "3": _userConsoleUI.UpdateUserByGuid(User.Parse(Console.ReadLine())); break;
|
||||||
|
case "4": _userConsoleUI.DisplayUserByGuid(Guid.Parse(Console.ReadLine())); break;
|
||||||
|
case "5": _groupConsoleUI.DisplayAllGroups(); break;
|
||||||
|
case "6": _groupConsoleUI.CreateNewGroup(Group.Parse(Console.ReadLine())); break;
|
||||||
|
case "7": _groupConsoleUI.UpdateGroupName(Group.Parse(Console.ReadLine())); break; //todo
|
||||||
|
|
||||||
|
default: DisplayMenu();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
88
UI/UserConsole.cs
Normal file
88
UI/UserConsole.cs
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
using System.Text;
|
||||||
|
using Demo.Domain.Models;
|
||||||
|
using Demo.Domain.UseCase;
|
||||||
|
|
||||||
|
namespace Demo.UI
|
||||||
|
{
|
||||||
|
public class UserConsoleUI
|
||||||
|
{
|
||||||
|
UserUseCase _userUseCase;
|
||||||
|
public UserConsoleUI(UserUseCase userUseCase) {
|
||||||
|
_userUseCase = userUseCase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveUserByGuid(Guid guidUser) {
|
||||||
|
|
||||||
|
string output = _userUseCase.RemoveUserByGuid(guidUser) ? "Пользователь удален" : "Пользователь не удален";
|
||||||
|
Console.WriteLine(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DisplayAllUsers()
|
||||||
|
{
|
||||||
|
StringBuilder userOutput = new StringBuilder();
|
||||||
|
foreach (var user in _userUseCase.GetAllUsers())
|
||||||
|
{
|
||||||
|
userOutput.AppendLine($"{user.Guid}\t{user.FIO}\t{user.Group.Name}");
|
||||||
|
}
|
||||||
|
Console.WriteLine(userOutput);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateUserByGuid(User user)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
User output = _userUseCase.UpdateUser(user);
|
||||||
|
StringBuilder userOutput = new StringBuilder();
|
||||||
|
userOutput.AppendLine($"Обновленный пользователь: {output.Guid}\t{output.FIO}\t{output.Group.Name}");
|
||||||
|
Console.WriteLine(userOutput);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Ошибка при обновлении пользователя: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DisplayUserByGuid(Guid guid){
|
||||||
|
User output = _userUseCase.GetUserByGuid(guid);
|
||||||
|
StringBuilder userOutput = new StringBuilder();
|
||||||
|
userOutput.AppendLine($"{output.Guid}\t{output.FIO}\t{output.Group.Name}");
|
||||||
|
Console.WriteLine(userOutput);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class GroupConsoleUI
|
||||||
|
{
|
||||||
|
GroupUseCase _groupUseCase;
|
||||||
|
public GroupConsoleUI(GroupUseCase groupUseCase){
|
||||||
|
_groupUseCase = groupUseCase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DisplayAllGroups(){
|
||||||
|
StringBuilder userOutput = new StringBuilder();
|
||||||
|
foreach (var group in _groupUseCase.GetAllGroups())
|
||||||
|
{
|
||||||
|
userOutput.AppendLine($"{group.ID}\t{group.Name}");
|
||||||
|
}
|
||||||
|
Console.WriteLine(userOutput);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CreateNewGroup(Group group){
|
||||||
|
string output = _groupUseCase.CreateNewGroup(group) ? "Пользователь создан" : "Пользователь не создан";
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateGroupName(Group group)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Group output = _groupUseCase.UpdateUser(group);
|
||||||
|
StringBuilder groupOutput = new StringBuilder();
|
||||||
|
groupOutput.AppendLine($"Обновленная группа: {output.ID}\t{output.Name}");
|
||||||
|
Console.WriteLine(groupOutput);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Ошибка при обновлении группы: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
bin/Debug/net8.0/Demo
Executable file
BIN
bin/Debug/net8.0/Demo
Executable file
Binary file not shown.
23
bin/Debug/net8.0/Demo.deps.json
Normal file
23
bin/Debug/net8.0/Demo.deps.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"runtimeTarget": {
|
||||||
|
"name": ".NETCoreApp,Version=v8.0",
|
||||||
|
"signature": ""
|
||||||
|
},
|
||||||
|
"compilationOptions": {},
|
||||||
|
"targets": {
|
||||||
|
".NETCoreApp,Version=v8.0": {
|
||||||
|
"Demo/1.0.0": {
|
||||||
|
"runtime": {
|
||||||
|
"Demo.dll": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"libraries": {
|
||||||
|
"Demo/1.0.0": {
|
||||||
|
"type": "project",
|
||||||
|
"serviceable": false,
|
||||||
|
"sha512": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
bin/Debug/net8.0/Demo.dll
Normal file
BIN
bin/Debug/net8.0/Demo.dll
Normal file
Binary file not shown.
BIN
bin/Debug/net8.0/Demo.pdb
Normal file
BIN
bin/Debug/net8.0/Demo.pdb
Normal file
Binary file not shown.
12
bin/Debug/net8.0/Demo.runtimeconfig.json
Normal file
12
bin/Debug/net8.0/Demo.runtimeconfig.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"runtimeOptions": {
|
||||||
|
"tfm": "net8.0",
|
||||||
|
"framework": {
|
||||||
|
"name": "Microsoft.NETCore.App",
|
||||||
|
"version": "8.0.0"
|
||||||
|
},
|
||||||
|
"configProperties": {
|
||||||
|
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
// <autogenerated />
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
|
22
obj/Debug/net8.0/Demo.AssemblyInfo.cs
Normal file
22
obj/Debug/net8.0/Demo.AssemblyInfo.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
using System;
|
||||||
|
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")]
|
||||||
|
[assembly: System.Reflection.AssemblyProductAttribute("Demo")]
|
||||||
|
[assembly: System.Reflection.AssemblyTitleAttribute("Demo")]
|
||||||
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|
||||||
|
// Создано классом WriteCodeFragment MSBuild.
|
||||||
|
|
1
obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache
Normal file
1
obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache
Normal file
@ -0,0 +1 @@
|
|||||||
|
eb16b2b154799358c5c37f7f25193ef306ab5592617791ff431f7a24a66875c2
|
@ -0,0 +1,13 @@
|
|||||||
|
is_global = true
|
||||||
|
build_property.TargetFramework = net8.0
|
||||||
|
build_property.TargetPlatformMinVersion =
|
||||||
|
build_property.UsingMicrosoftNETSdkWeb =
|
||||||
|
build_property.ProjectTypeGuids =
|
||||||
|
build_property.InvariantGlobalization =
|
||||||
|
build_property.PlatformNeutralAssembly =
|
||||||
|
build_property.EnforceExtendedAnalyzerRules =
|
||||||
|
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||||
|
build_property.RootNamespace = Demo
|
||||||
|
build_property.ProjectDir = /Users/rinchi/VSCodeProjects/Demo/
|
||||||
|
build_property.EnableComHosting =
|
||||||
|
build_property.EnableGeneratedComInterfaceComImportInterop =
|
8
obj/Debug/net8.0/Demo.GlobalUsings.g.cs
Normal file
8
obj/Debug/net8.0/Demo.GlobalUsings.g.cs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// <auto-generated/>
|
||||||
|
global using global::System;
|
||||||
|
global using global::System.Collections.Generic;
|
||||||
|
global using global::System.IO;
|
||||||
|
global using global::System.Linq;
|
||||||
|
global using global::System.Net.Http;
|
||||||
|
global using global::System.Threading;
|
||||||
|
global using global::System.Threading.Tasks;
|
BIN
obj/Debug/net8.0/Demo.assets.cache
Normal file
BIN
obj/Debug/net8.0/Demo.assets.cache
Normal file
Binary file not shown.
1
obj/Debug/net8.0/Demo.csproj.CoreCompileInputs.cache
Normal file
1
obj/Debug/net8.0/Demo.csproj.CoreCompileInputs.cache
Normal file
@ -0,0 +1 @@
|
|||||||
|
05407eb2645f69ef3210525c6e96fe1840a0c5f34e2e112238637ba9ea98449a
|
14
obj/Debug/net8.0/Demo.csproj.FileListAbsolute.txt
Normal file
14
obj/Debug/net8.0/Demo.csproj.FileListAbsolute.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/Users/rinchi/VSCodeProjects/Demo/bin/Debug/net8.0/Demo
|
||||||
|
/Users/rinchi/VSCodeProjects/Demo/bin/Debug/net8.0/Demo.deps.json
|
||||||
|
/Users/rinchi/VSCodeProjects/Demo/bin/Debug/net8.0/Demo.runtimeconfig.json
|
||||||
|
/Users/rinchi/VSCodeProjects/Demo/bin/Debug/net8.0/Demo.dll
|
||||||
|
/Users/rinchi/VSCodeProjects/Demo/bin/Debug/net8.0/Demo.pdb
|
||||||
|
/Users/rinchi/VSCodeProjects/Demo/obj/Debug/net8.0/Demo.GeneratedMSBuildEditorConfig.editorconfig
|
||||||
|
/Users/rinchi/VSCodeProjects/Demo/obj/Debug/net8.0/Demo.AssemblyInfoInputs.cache
|
||||||
|
/Users/rinchi/VSCodeProjects/Demo/obj/Debug/net8.0/Demo.AssemblyInfo.cs
|
||||||
|
/Users/rinchi/VSCodeProjects/Demo/obj/Debug/net8.0/Demo.csproj.CoreCompileInputs.cache
|
||||||
|
/Users/rinchi/VSCodeProjects/Demo/obj/Debug/net8.0/Demo.dll
|
||||||
|
/Users/rinchi/VSCodeProjects/Demo/obj/Debug/net8.0/refint/Demo.dll
|
||||||
|
/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
|
BIN
obj/Debug/net8.0/Demo.dll
Normal file
BIN
obj/Debug/net8.0/Demo.dll
Normal file
Binary file not shown.
1
obj/Debug/net8.0/Demo.genruntimeconfig.cache
Normal file
1
obj/Debug/net8.0/Demo.genruntimeconfig.cache
Normal file
@ -0,0 +1 @@
|
|||||||
|
4a28aaadb24bbda6efe4e166a6aa1429c71cc10a5e61120ecc4d0254fdc8c341
|
BIN
obj/Debug/net8.0/Demo.pdb
Normal file
BIN
obj/Debug/net8.0/Demo.pdb
Normal file
Binary file not shown.
BIN
obj/Debug/net8.0/apphost
Executable file
BIN
obj/Debug/net8.0/apphost
Executable file
Binary file not shown.
BIN
obj/Debug/net8.0/ref/Demo.dll
Normal file
BIN
obj/Debug/net8.0/ref/Demo.dll
Normal file
Binary file not shown.
BIN
obj/Debug/net8.0/refint/Demo.dll
Normal file
BIN
obj/Debug/net8.0/refint/Demo.dll
Normal file
Binary file not shown.
66
obj/Demo.csproj.nuget.dgspec.json
Normal file
66
obj/Demo.csproj.nuget.dgspec.json
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
{
|
||||||
|
"format": 1,
|
||||||
|
"restore": {
|
||||||
|
"/Users/rinchi/VSCodeProjects/Demo/Demo.csproj": {}
|
||||||
|
},
|
||||||
|
"projects": {
|
||||||
|
"/Users/rinchi/VSCodeProjects/Demo/Demo.csproj": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"restore": {
|
||||||
|
"projectUniqueName": "/Users/rinchi/VSCodeProjects/Demo/Demo.csproj",
|
||||||
|
"projectName": "Demo",
|
||||||
|
"projectPath": "/Users/rinchi/VSCodeProjects/Demo/Demo.csproj",
|
||||||
|
"packagesPath": "/Users/rinchi/.nuget/packages/",
|
||||||
|
"outputPath": "/Users/rinchi/VSCodeProjects/Demo/obj/",
|
||||||
|
"projectStyle": "PackageReference",
|
||||||
|
"configFilePaths": [
|
||||||
|
"/Users/rinchi/.nuget/NuGet/NuGet.Config"
|
||||||
|
],
|
||||||
|
"originalTargetFrameworks": [
|
||||||
|
"net8.0"
|
||||||
|
],
|
||||||
|
"sources": {
|
||||||
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net8.0": {
|
||||||
|
"targetAlias": "net8.0",
|
||||||
|
"projectReferences": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"warningProperties": {
|
||||||
|
"warnAsError": [
|
||||||
|
"NU1605"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"restoreAuditProperties": {
|
||||||
|
"enableAudit": "true",
|
||||||
|
"auditLevel": "low",
|
||||||
|
"auditMode": "direct"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net8.0": {
|
||||||
|
"targetAlias": "net8.0",
|
||||||
|
"imports": [
|
||||||
|
"net461",
|
||||||
|
"net462",
|
||||||
|
"net47",
|
||||||
|
"net471",
|
||||||
|
"net472",
|
||||||
|
"net48",
|
||||||
|
"net481"
|
||||||
|
],
|
||||||
|
"assetTargetFallback": true,
|
||||||
|
"warn": true,
|
||||||
|
"frameworkReferences": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"privateAssets": "all"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/8.0.402/PortableRuntimeIdentifierGraph.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
obj/Demo.csproj.nuget.g.props
Normal file
15
obj/Demo.csproj.nuget.g.props
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||||
|
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||||
|
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||||
|
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/rinchi/.nuget/packages/</NuGetPackageRoot>
|
||||||
|
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/rinchi/.nuget/packages/</NuGetPackageFolders>
|
||||||
|
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||||
|
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.11.1</NuGetToolVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<SourceRoot Include="/Users/rinchi/.nuget/packages/" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
2
obj/Demo.csproj.nuget.g.targets
Normal file
2
obj/Demo.csproj.nuget.g.targets
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
71
obj/project.assets.json
Normal file
71
obj/project.assets.json
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"targets": {
|
||||||
|
"net8.0": {}
|
||||||
|
},
|
||||||
|
"libraries": {},
|
||||||
|
"projectFileDependencyGroups": {
|
||||||
|
"net8.0": []
|
||||||
|
},
|
||||||
|
"packageFolders": {
|
||||||
|
"/Users/rinchi/.nuget/packages/": {}
|
||||||
|
},
|
||||||
|
"project": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"restore": {
|
||||||
|
"projectUniqueName": "/Users/rinchi/VSCodeProjects/Demo/Demo.csproj",
|
||||||
|
"projectName": "Demo",
|
||||||
|
"projectPath": "/Users/rinchi/VSCodeProjects/Demo/Demo.csproj",
|
||||||
|
"packagesPath": "/Users/rinchi/.nuget/packages/",
|
||||||
|
"outputPath": "/Users/rinchi/VSCodeProjects/Demo/obj/",
|
||||||
|
"projectStyle": "PackageReference",
|
||||||
|
"configFilePaths": [
|
||||||
|
"/Users/rinchi/.nuget/NuGet/NuGet.Config"
|
||||||
|
],
|
||||||
|
"originalTargetFrameworks": [
|
||||||
|
"net8.0"
|
||||||
|
],
|
||||||
|
"sources": {
|
||||||
|
"https://api.nuget.org/v3/index.json": {}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net8.0": {
|
||||||
|
"targetAlias": "net8.0",
|
||||||
|
"projectReferences": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"warningProperties": {
|
||||||
|
"warnAsError": [
|
||||||
|
"NU1605"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"restoreAuditProperties": {
|
||||||
|
"enableAudit": "true",
|
||||||
|
"auditLevel": "low",
|
||||||
|
"auditMode": "direct"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"frameworks": {
|
||||||
|
"net8.0": {
|
||||||
|
"targetAlias": "net8.0",
|
||||||
|
"imports": [
|
||||||
|
"net461",
|
||||||
|
"net462",
|
||||||
|
"net47",
|
||||||
|
"net471",
|
||||||
|
"net472",
|
||||||
|
"net48",
|
||||||
|
"net481"
|
||||||
|
],
|
||||||
|
"assetTargetFallback": true,
|
||||||
|
"warn": true,
|
||||||
|
"frameworkReferences": {
|
||||||
|
"Microsoft.NETCore.App": {
|
||||||
|
"privateAssets": "all"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/8.0.402/PortableRuntimeIdentifierGraph.json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
obj/project.nuget.cache
Normal file
8
obj/project.nuget.cache
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"version": 2,
|
||||||
|
"dgSpecHash": "cqUSRourbns=",
|
||||||
|
"success": true,
|
||||||
|
"projectFilePath": "/Users/rinchi/VSCodeProjects/Demo/Demo.csproj",
|
||||||
|
"expectedPackageFiles": [],
|
||||||
|
"logs": []
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user