diff --git a/123/Data/ReportsHistory/GroupRepositoty.cs b/123/Data/ReportsHistory/GroupRepositoty.cs new file mode 100644 index 0000000..8d8d97a --- /dev/null +++ b/123/Data/ReportsHistory/GroupRepositoty.cs @@ -0,0 +1,33 @@ +using _123.Data.LocalData.Entity; +using _123.Data.LocalData; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace _123.Data.ReportsHistory +{ + + public class GroupRepositoryImpl + { + public List GetAllGroups() => LocalStaticData.groups; + + public GroupLocalEntity? UpdateGroup(String name) + { + GroupLocalEntity? groupLocal = GetAllGroups() + .Where(x => x.Name == name).FirstOrDefault(); + if (groupLocal == null) return null; + groupLocal.Name = name; + return groupLocal; + } + public GroupLocalEntity AddGroup(String name, String id) + { + GroupLocalEntity? groupLocal = GetAllGroups().FirstOrDefault(); + groupLocal.Name = name; + groupLocal.ID = int.Parse(id); + return groupLocal; + + } + } + } diff --git a/123/Domain/UseCase/GroupUseCase.cs b/123/Domain/UseCase/GroupUseCase.cs index ffbfc1f..cf60f4a 100644 --- a/123/Domain/UseCase/GroupUseCase.cs +++ b/123/Domain/UseCase/GroupUseCase.cs @@ -42,5 +42,9 @@ namespace _123.Domain.UseCase { return _repositoryGroupImpl.RemoveGroupById(id); } + public GroupLocalEntity AddGroup(String name, string id) + { + return _repositoryGroupImpl.AddGroup(name, id); + } } } diff --git a/123/UI/GroupConsole.cs b/123/UI/GroupConsole.cs index 437be4b..a812fb6 100644 --- a/123/UI/GroupConsole.cs +++ b/123/UI/GroupConsole.cs @@ -33,6 +33,13 @@ namespace _123.UI { StringBuilder groupOutput = new StringBuilder(); var group = _groupUseCase.AddGroup(name,id); +<<<<<<< HEAD +======= + { + groupOutput.AppendLine($"{group.Name}\t{group.ID}"); + } + Console.WriteLine(groupOutput); +>>>>>>> b274d8f88d0df85505fa497de11d07625bde956d } } diff --git a/123/UI/MainMenu.cs b/123/UI/MainMenu.cs index db97c76..e716d58 100644 --- a/123/UI/MainMenu.cs +++ b/123/UI/MainMenu.cs @@ -35,6 +35,7 @@ namespace _123.UI case "1": _userConsoleUI.DisplayAllUsers(); break; case "2": _userConsoleUI.RemoveUserByGuid(Guid.Parse(Console.ReadLine())); break; case "3": _groupConsoleUI.DisplayAllGroups(); break; +<<<<<<< HEAD case "4": _userConsoleUI.FindUserById(int.Parse(Console.ReadLine())); break; case "5": _userConsoleUI.UpdateUserById(int.Parse(Console.ReadLine()), Console.ReadLine(), Console.ReadLine()); break; case "6": _groupConsoleUI.UpdateGroupName(Console.ReadLine(), Console.ReadLine()); break; @@ -44,6 +45,12 @@ namespace _123.UI case "10": _presenceConsoleUI.UnCheckAttendence(int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()), DateOnly.Parse(Console.ReadLine()), Guid.Parse(Console.ReadLine())); break; case "11": _presenceConsoleUI.AddPresence(int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()), int.Parse(Console.ReadLine()), DateOnly.Parse(Console.ReadLine())); break; +======= + case "4": _userConsoleUI.FindUserByGuid(Guid.Parse(Console.ReadLine()));break; + case "5": _userConsoleUI.UpdateUserByGuid(Guid.Parse(Console.ReadLine()),Console.ReadLine(), Console.ReadLine()); break; + case "6": _groupConsoleUI.UpdateGroupName(Console.ReadLine(),Console.ReadLine()); break; + case "7": _groupConsoleUI.AddGroup(Console.ReadLine(), Console.ReadLine());break; +>>>>>>> b274d8f88d0df85505fa497de11d07625bde956d default: DisplayMenu(); break;