From 023f6a3f3f79bbba7cbecb5a625f59d0d0900e25 Mon Sep 17 00:00:00 2001 From: Userok Date: Sat, 2 Nov 2024 10:50:36 +0300 Subject: [PATCH] --- Zurnal/Date/Repository/GroupRepositoryImpl.cs | 96 ++++++++----------- Zurnal/RemaDateBase/DateDao/GroupDao.cs | 10 +- .../obj/Debug/net8.0/Zurnal.AssemblyInfo.cs | 2 +- .../net8.0/Zurnal.AssemblyInfoInputs.cache | 2 +- 4 files changed, 48 insertions(+), 62 deletions(-) diff --git a/Zurnal/Date/Repository/GroupRepositoryImpl.cs b/Zurnal/Date/Repository/GroupRepositoryImpl.cs index 96dac90..5941b31 100644 --- a/Zurnal/Date/Repository/GroupRepositoryImpl.cs +++ b/Zurnal/Date/Repository/GroupRepositoryImpl.cs @@ -14,9 +14,9 @@ namespace Zurnal.Data.Repository public List AllGroup => GroupDao.Name.ToList(); public IEnumerable GetAllGroups() - { - return GroupDao.Name; - } +{ + return GroupDao.Name; +} public void AddGroup(GroupDao group) { @@ -28,30 +28,36 @@ namespace Zurnal.Data.Repository } public void UpdateGroupName(int groupId, string name) - { - var group = GroupDao.Name.FirstOrDefault(g => g.Id == groupId); - if (group != null) - { - group.Name = name; - } - } +{ + var group = GroupDao.Name.FirstOrDefault(g => g.Id == groupId); + if (group != null) + { + group.GroupName = name; + } +} - public GroupDao GetGroupById(int id) - { - return GroupDao.groups.FirstOrDefault(g => g.Id == id); - } +public bool UpdateGroupById(int groupId, GroupDao updatedGroup) +{ + var group = GroupDao.Name.FirstOrDefault(g => g.Id == groupId); + if (group != null) + { + group.GroupName = updatedGroup.GroupName; + return true; + } + return false; +} private static string GetDebuggerDisplay() { - return $"GroupRepository with {GroupDao.groups.Count} groups"; + return $"GroupRepository with {GroupDao.Name.Count} groups"; } public bool RemoveGroupById(int groupId) { - var group = GroupDao.groups.FirstOrDefault(g => g.Id == groupId); + var group = GroupDao.Name.FirstOrDefault(g => g.Id == groupId); if (group != null) { - GroupDao.groups.Remove(group); + GroupDao.Name.Remove(group); return true; } return false; @@ -59,61 +65,41 @@ namespace Zurnal.Data.Repository public IEnumerable AllGroups() { - return GroupDao.groups.Select(g => new GroupDao { GroupName = g.Name, Id = g.Id }); - } - - public bool UpdateGroupById(int groupId, GroupDao updatedGroup) - { - var group = GroupDao.groups.FirstOrDefault(g => g.Id == groupId); - if (group != null) - { - group.Name = updatedGroup.GroupName; - return true; - } - return false; - } - - public void UpdateGroup(GroupDao group) - { - var existingGroup = GroupDao.groups.FirstOrDefault(g => g.Id == group.Id); - if (existingGroup != null) - { - existingGroup.Name = group.GroupName; - } + return GroupDao.Name.Select(g => new GroupDao { GroupName = g.GroupName, Id = g.Id }); } public void DeleteGroup(int id) { - var group = GroupDao.groups.FirstOrDefault(g => g.Id == id); + var group = GroupDao.Name.FirstOrDefault(g => g.Id == id); if (group != null) { - GroupDao.groups.Remove(group); + GroupDao.Name.Remove(group); } } - public bool AddGroup(GroupDao newGroup) - { - if (newGroup == null) - { - throw new ArgumentNullException(nameof(newGroup)); - } - GroupDao.groups.Add(newGroup); - return true; - } - - public void AddGroupFromRegex(Group group) - { - throw new NotImplementedException(); - } - IEnumerable IGroupRepository.AllGroups() { throw new NotImplementedException(); } + 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(); + } } } \ No newline at end of file diff --git a/Zurnal/RemaDateBase/DateDao/GroupDao.cs b/Zurnal/RemaDateBase/DateDao/GroupDao.cs index a365118..336c9fd 100644 --- a/Zurnal/RemaDateBase/DateDao/GroupDao.cs +++ b/Zurnal/RemaDateBase/DateDao/GroupDao.cs @@ -1,11 +1,11 @@ namespace Zurnal.RemaDateBase.DateDao { public class GroupDao -{ - internal static IEnumerable Name; + { + internal static List Name = new List(); public int Id { get; set; } - public required string GroupName { get; set; } - public IEnumerable Users { get; set; } -} + public required string GroupName { get; set; } + public IEnumerable Users { get; set; } + } } \ No newline at end of file diff --git a/Zurnal/obj/Debug/net8.0/Zurnal.AssemblyInfo.cs b/Zurnal/obj/Debug/net8.0/Zurnal.AssemblyInfo.cs index c589e4d..3c016f8 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+d72fa803793c5d114c3eabb8fe2de04cd2042db1")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d8b97b4d4726ad4a4fb1b1f71d1f4e9c62ebd29b")] [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 1282f10..0154547 100644 --- a/Zurnal/obj/Debug/net8.0/Zurnal.AssemblyInfoInputs.cache +++ b/Zurnal/obj/Debug/net8.0/Zurnal.AssemblyInfoInputs.cache @@ -1 +1 @@ -7af827faec1f5dd576cc86e70a9c41ec992b431c5545340778b3dec093fd4ac1 +c3dcf515a535c8feb2557d6f2ba5b36f9feac86b0ec88244007d55a701c20bcf