From 6c6af92b8bce2184471eb8435f679b923fc5c68f Mon Sep 17 00:00:00 2001 From: adm Date: Wed, 23 Oct 2024 10:47:07 +0300 Subject: [PATCH] add grouprepository --- Demo/Data/LocalData/Entity/Presence.cs | 2 +- Demo/Data/LocalData/LocalStaticData.cs | 28 ++++++++++++++++++++++ Demo/Data/Repository/UserRepositoryImpl.cs | 9 ++----- Demo/Domain/UseCase/UserUseCase.cs | 6 +++++ Demo/Program.cs | 13 +--------- 5 files changed, 38 insertions(+), 20 deletions(-) diff --git a/Demo/Data/LocalData/Entity/Presence.cs b/Demo/Data/LocalData/Entity/Presence.cs index 70b8d1e..71c2474 100644 --- a/Demo/Data/LocalData/Entity/Presence.cs +++ b/Demo/Data/LocalData/Entity/Presence.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace Demo.domain.Models { - internal class PresenceLocalEntity + public class PresenceLocalEntity { public required Guid UserGuid { get; set; } public bool IsAttedance { get; set; } = true; diff --git a/Demo/Data/LocalData/LocalStaticData.cs b/Demo/Data/LocalData/LocalStaticData.cs index 50e54f7..6b3d38a 100644 --- a/Demo/Data/LocalData/LocalStaticData.cs +++ b/Demo/Data/LocalData/LocalStaticData.cs @@ -27,5 +27,33 @@ namespace Demo.Data.LocalData new UserLocalEnity{Guid=Guid.Parse("efcc1473-c116-4244-b3f7-f2341a5c3003"), FIO = "RandomFio4", GroupID = 2 }, new UserLocalEnity{Guid=Guid.Parse("60640fb3-ace2-4cad-81d5-a0a58bc2dbbd"), FIO = "RandomFio5", GroupID = 3 }, }; + + public static List presences => new List { + new PresenceLocalEntity { + Date = DateOnly.FromDateTime(DateTime.Now), + IsAttedance = true, + LessonNumber = 1, + UserGuid = Guid.Parse("e6b9964d-ea9f-420a-84b9-af9633bbfab9")}, + new PresenceLocalEntity { + Date = DateOnly.FromDateTime(DateTime.Now), + IsAttedance = true, + LessonNumber = 2, + UserGuid = Guid.Parse("e6b9964d-ea9f-420a-84b9-af9633bbfab9")}, + new PresenceLocalEntity { + Date = DateOnly.FromDateTime(DateTime.Now), + IsAttedance = true, + LessonNumber = 3, + UserGuid = Guid.Parse("e6b9964d-ea9f-420a-84b9-af9633bbfab9") }, + new PresenceLocalEntity { + Date = DateOnly.FromDateTime(DateTime.Now), + IsAttedance = true, + LessonNumber = 4, + UserGuid = Guid.Parse("e6b9964d-ea9f-420a-84b9-af9633bbfab9") }, + new PresenceLocalEntity { + Date = DateOnly.FromDateTime(DateTime.Now), + IsAttedance = true, + LessonNumber = 4, + UserGuid = Guid.Parse("e6b9964d-ea9f-420a-84b9-af9633bbfab9") } + }; } } diff --git a/Demo/Data/Repository/UserRepositoryImpl.cs b/Demo/Data/Repository/UserRepositoryImpl.cs index bf9ae8c..648efe1 100644 --- a/Demo/Data/Repository/UserRepositoryImpl.cs +++ b/Demo/Data/Repository/UserRepositoryImpl.cs @@ -10,13 +10,8 @@ namespace Demo.Data.Repository { public class UserRepositoryImpl { - public UserRepositoryImpl() { - - GetAllUsers = LocalStaticData.users; - } - public List GetAllUsers - { get; set; } - + + public List GetAllUsers = new List(); public bool RemoveUserByGuid(Guid userGuid) { UserLocalEnity? userLocal = GetAllUsers diff --git a/Demo/Domain/UseCase/UserUseCase.cs b/Demo/Domain/UseCase/UserUseCase.cs index f176969..245918b 100644 --- a/Demo/Domain/UseCase/UserUseCase.cs +++ b/Demo/Domain/UseCase/UserUseCase.cs @@ -13,6 +13,12 @@ namespace Demo.Domain.UseCase private readonly UserRepositoryImpl _repositoryUserImpl; private readonly IGroupRepository _repositoryGroupImpl; + public UserUseCase(IGroupRepository repository) { + + _repositoryGroupImpl = repository; + _repositoryUserImpl = new UserRepositoryImpl(); + } + public UserUseCase(UserRepositoryImpl repositoryImpl, IGroupRepository repositoryGroupImpl) { _repositoryUserImpl = repositoryImpl; diff --git a/Demo/Program.cs b/Demo/Program.cs index 303435b..5f28270 100644 --- a/Demo/Program.cs +++ b/Demo/Program.cs @@ -1,12 +1 @@ - -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); - -MainMenuUI mainMenuUI = new MainMenuUI(userUseCase); \ No newline at end of file + \ No newline at end of file