diff --git a/123/Data/ReportsHistory/GroupRepositoty.cs b/123/Data/ReportsHistory/GroupRepositoty.cs index 079bdba..8d8d97a 100644 --- a/123/Data/ReportsHistory/GroupRepositoty.cs +++ b/123/Data/ReportsHistory/GroupRepositoty.cs @@ -21,9 +21,13 @@ namespace _123.Data.ReportsHistory groupLocal.Name = name; return groupLocal; } - //public GroupLocalEntity AddGroup(String name, String id) - //{ - // List groups => new List - //} + 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 4d08baf..fece855 100644 --- a/123/Domain/UseCase/GroupUseCase.cs +++ b/123/Domain/UseCase/GroupUseCase.cs @@ -27,6 +27,10 @@ namespace _123.Domain.UseCase if (group == null) throw new Exception(""); return new Group { ID = group.ID, Name = name1 }; } + 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 e19ce86..6d145d2 100644 --- a/123/UI/GroupConsole.cs +++ b/123/UI/GroupConsole.cs @@ -33,5 +33,15 @@ namespace _123.UI } Console.WriteLine(groupOutput); } + public void AddGroup (String name, String id) + { + StringBuilder groupOutput = new StringBuilder(); + var group = _groupUseCase.AddGroup(name,id); + { + groupOutput.AppendLine($"{group.Name}\t{group.ID}"); + } + Console.WriteLine(groupOutput); + } + } } \ No newline at end of file diff --git a/123/UI/MainMenu.cs b/123/UI/MainMenu.cs index 40d666c..8099cb6 100644 --- a/123/UI/MainMenu.cs +++ b/123/UI/MainMenu.cs @@ -34,7 +34,8 @@ namespace _123.UI case "3": _groupConsoleUI.DisplayAllGroups(); 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 "6": _groupConsoleUI.UpdateGroupName(Console.ReadLine(),Console.ReadLine()); break; + case "7": _groupConsoleUI.AddGroup(Console.ReadLine(), Console.ReadLine());break; default: DisplayMenu(); break;