diff --git a/Zurnal/Date/Repository/GroupRepositoryImpl.cs b/Zurnal/Date/Repository/GroupRepositoryImpl.cs index 63dd5d4..8bdef94 100644 --- a/Zurnal/Date/Repository/GroupRepositoryImpl.cs +++ b/Zurnal/Date/Repository/GroupRepositoryImpl.cs @@ -1,5 +1,4 @@ using System.Diagnostics; -using Zurnal.Date.Repository; using Zurnal.RemaDateBase.DateDao; using System.Text.RegularExpressions; @@ -73,22 +72,6 @@ public bool UpdateGroupById(int groupId, GroupDao updatedGroup) GroupDao.Name.Remove(group); } } - - bool IGroupRepository.AddGroup(GroupDao newGroup) - { - throw new NotImplementedException(); - } - - public void AddGroupFromRegex(Group group) - { - throw new NotImplementedException(); - } - - public GroupDao GetGroupById(int id) - { - throw new NotImplementedException(); - } - public void UpdateGroup(GroupDao group) { throw new NotImplementedException(); diff --git a/Zurnal/Date/Repository/IGroupRepository.cs b/Zurnal/Date/Repository/IGroupRepository.cs index 99bd685..e4dd88b 100644 --- a/Zurnal/Date/Repository/IGroupRepository.cs +++ b/Zurnal/Date/Repository/IGroupRepository.cs @@ -1,65 +1,65 @@ using Zurnal.RemaDateBase.DateDao; -using Microsoft.Extensions.DependencyInjection; -using Group = System.Text.RegularExpressions.Group; -namespace Zurnal.Date.Repository +internal interface IGroupRepository { - internal interface IGroupRepository - { - List AllGroup { get; } + List AllGroup { get; } - public IEnumerable AllGroups() - { - return GroupDao.Name.Select(g => new GroupDao { GroupName = g.GroupName, Id = g.Id }); - } - public bool RemoveGroupById(int groupId) - { - var group = GroupDao.Name.FirstOrDefault(g => g.Id == groupId); - if (group != null) - { - GroupDao.Name.Remove(group); - return true; - } - return false; - } - public bool UpdateGroupById(int groupId, GroupDao updatedGroup) -{ - var group = GroupDao.Name.FirstOrDefault(g => g.Id == groupId); - if (group != null) + public IEnumerable AllGroups() { - group.GroupName = updatedGroup.GroupName; - return true; - } - return false; -} - -public void DeleteGroup(int id) - { - var group = GroupDao.Name.FirstOrDefault(g => g.Id == id); - if (group != null) - { - GroupDao.Name.Remove(group); - } - } - void AddGroupFromRegex(Group group); - public GroupDao GetGroupById(int id); - IEnumerable GetAllGroups(); -public void UpdateGroupName(int groupId, string name) -{ - var group = GroupDao.Name.FirstOrDefault(g => g.Id == groupId); - if (group != null) - { - group.GroupName = name; - } -} + return AllGroup.Select(g => new GroupDao { GroupName = g.GroupName, Id = g.Id }); } - internal class ServiceConfiguration + public bool RemoveGroupById(int groupId) { - public static void ConfigureServices(IServiceCollection services) + var group = AllGroup.FirstOrDefault(g => g.Id == groupId); + if (group != null) { - services.AddDbContext() - .AddScoped(); + AllGroup.Remove(group); + return true; + } + return false; + } + + public GroupDao FindGroupById(int groupId) + { + return AllGroup.FirstOrDefault(g => g.Id == groupId); + } + + public bool UpdateGroupById(int groupId, GroupDao updatedGroup) + { + if (updatedGroup == null) throw new ArgumentNullException(nameof(updatedGroup)); + + var group = AllGroup.FirstOrDefault(g => g.Id == groupId); + if (group != null) + { + group.GroupName = updatedGroup.GroupName; + return true; + } + return false; + } + + public void DeleteGroup(int id) + { + var group = AllGroup.FirstOrDefault(g => g.Id == id); + if (group != null) + { + AllGroup.Remove(group); + } + } + + public IEnumerable GetAllGroups() + { + return AllGroup; + } + + public void UpdateGroupName(int groupId, string name) + { + if (name == null) throw new ArgumentNullException(nameof(name)); + + var group = AllGroup.FirstOrDefault(g => g.Id == groupId); + if (group != null) + { + group.GroupName = name; } } } \ No newline at end of file diff --git a/Zurnal/Date/Repository/UserRepositoryImpl.cs b/Zurnal/Date/Repository/UserRepositoryImpl.cs index aba782b..4979876 100644 --- a/Zurnal/Date/Repository/UserRepositoryImpl.cs +++ b/Zurnal/Date/Repository/UserRepositoryImpl.cs @@ -1,6 +1,5 @@ using Zurnal.domain.Models; using Zurnal.Date.LocalDate; -using Zurnal.Date.Repository; using Zurnal.Domain.UseCase; using Zurnal.RemaDateBase.DateDao; @@ -12,6 +11,8 @@ namespace Zurnal.Data.Repository public List GetAllUsers { get; set; } + public List AllGroup => throw new NotImplementedException(); + public bool RemoveUserByGuid(Guid userGuid) { UserLocalEnity? userLocal = GetAllUsers @@ -43,84 +44,5 @@ namespace Zurnal.Data.Repository { return GetAllUsers; } - - public List GetAllGroups() - { - throw new NotImplementedException(); - } - - public bool RemoveGroupById(int groupID) - { - throw new NotImplementedException(); - } - - public bool UpdateGroupById(int groupID, GroupLocalEntity updatedGroup) - { - throw new NotImplementedException(); - } - - public GroupLocalEntity GetGroupById(int groupID) - { - throw new NotImplementedException(); - } - - public bool AddGroup(GroupLocalEntity newGroup) - { - throw new NotImplementedException(); - } - - public IEnumerable AllGroups() - { - throw new NotImplementedException(); - } - - public bool UpdateGroupById(int groupID, GroupDao updatedGroup) - { - throw new NotImplementedException(); - } - - public bool AddGroup(GroupDao newGroup) - { - throw new NotImplementedException(); - } - - public void AddGroupFromRegex(System.Text.RegularExpressions.Group group) - { - throw new NotImplementedException(); - } - - GroupDao IGroupRepository.GetGroupById(int id) - { - throw new NotImplementedException(); - } - - IEnumerable IGroupRepository.GetAllGroups() - { - throw new NotImplementedException(); - } - - public void UpdateGroup(GroupDao group) - { - throw new NotImplementedException(); - } - - public void DeleteGroup(int id) - { - throw new NotImplementedException(); - } - - internal UserUseCase.UserLocalEntity? UpdateUser(UserUseCase.UserLocalEntity userLocalEntity) - { - throw new NotImplementedException(); - } - - IEnumerable IGroupRepository.AllGroups() - { - throw new NotImplementedException(); - } - - public List AllGroup => throw new NotImplementedException(); - - List IGroupRepository.AllGroup => throw new NotImplementedException(); } } \ No newline at end of file diff --git a/Zurnal/Domain/UseCase/GroupUseCase.cs b/Zurnal/Domain/UseCase/GroupUseCase.cs index 194d8e7..dda8c54 100644 --- a/Zurnal/Domain/UseCase/GroupUseCase.cs +++ b/Zurnal/Domain/UseCase/GroupUseCase.cs @@ -1,16 +1,14 @@ -using System.Text.RegularExpressions; using Zurnal.Data.Repository; -using Zurnal.Date.Repository; using Zurnal.RemaDateBase.DateDao; namespace Zurnal.Domain.UseCase { public class GroupUseCase : IGroupRepository { private List _groups = new List(); + public List AllGroup => _groups; private UserRepositoryImpl _repositoryUserImpl; private GroupRepositoryImpl _repositoryGroupImpl; - public List AllGroup => throw new NotImplementedException(); public List GetAllGroups() => _repositoryGroupImpl.GetAllGroups() @@ -48,10 +46,6 @@ namespace Zurnal.Domain.UseCase return true; } - public bool UpdateGroupById(int groupID, GroupDao updatedGroup) - { - throw new NotImplementedException(); - } IEnumerable IGroupRepository.GetAllGroups() { @@ -60,35 +54,10 @@ namespace Zurnal.Domain.UseCase .ToList(); } - public void AddGroupFromRegex(System.Text.RegularExpressions.Group group) - { - throw new NotImplementedException(); - } public GroupDao GetGroupById(int id) { return _groups.FirstOrDefault(g => g.Id == id); } - - - public void UpdateGroup(GroupDao group) - { - throw new NotImplementedException(); - } - - public void DeleteGroup(int id) - { - throw new NotImplementedException(); - } - - IEnumerable IGroupRepository.AllGroups() - { - throw new NotImplementedException(); - } - - bool IGroupRepository.AddGroup(GroupDao newGroup) - { - throw new NotImplementedException(); - } } } \ No newline at end of file diff --git a/Zurnal/Domain/UseCase/UserUseCase.cs b/Zurnal/Domain/UseCase/UserUseCase.cs index 180dc05..d7baa96 100644 --- a/Zurnal/Domain/UseCase/UserUseCase.cs +++ b/Zurnal/Domain/UseCase/UserUseCase.cs @@ -1,5 +1,4 @@ using Zurnal.Data.Repository; -using Zurnal.Date.Repository; using Zurnal.RemaDateBase.DateDao; namespace Zurnal.Domain.UseCase diff --git a/Zurnal/obj/Debug/net8.0/Zurnal.AssemblyInfo.cs b/Zurnal/obj/Debug/net8.0/Zurnal.AssemblyInfo.cs index dca59e0..e900170 100644 --- a/Zurnal/obj/Debug/net8.0/Zurnal.AssemblyInfo.cs +++ b/Zurnal/obj/Debug/net8.0/Zurnal.AssemblyInfo.cs @@ -13,7 +13,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("Zurnal")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6882444548100e8c025d9e78806599aa8bb318a3")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+34ff2ea057283cd78eb7b49bd26432b8fed15732")] [assembly: System.Reflection.AssemblyProductAttribute("Zurnal")] [assembly: System.Reflection.AssemblyTitleAttribute("Zurnal")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] diff --git a/Zurnal/obj/Debug/net8.0/Zurnal.AssemblyInfoInputs.cache b/Zurnal/obj/Debug/net8.0/Zurnal.AssemblyInfoInputs.cache index d061c16..59afe9c 100644 --- a/Zurnal/obj/Debug/net8.0/Zurnal.AssemblyInfoInputs.cache +++ b/Zurnal/obj/Debug/net8.0/Zurnal.AssemblyInfoInputs.cache @@ -1 +1 @@ -9dff231535641cdfc92aca08ac3ded2ec8946da291a33bf90e9cc5f880b09a03 +0df9278f60a66dc8e6fa4dcbb3c724fa603d832d40511f5c21919f1d6dd33202