Added Add Group

This commit is contained in:
Dasha 2024-10-18 11:43:40 +03:00
parent 1305f40f24
commit 36a123355e
12 changed files with 25 additions and 5 deletions

View File

@ -22,5 +22,12 @@ namespace Posechaemost.Data.Repository
return groupLocal; return groupLocal;
} }
public GroupLocalEntity? AddGroup(String name, String id)
{
GroupLocalEntity? groupLocal = GetAllGroups().FirstOrDefault();
groupLocal.Name = name;
groupLocal.Id = int.Parse(id);
return groupLocal;
}
} }
} }

View File

@ -28,5 +28,9 @@ namespace Posechaemost.Domain.UseCase
if (group == null) throw new Exception(""); if (group == null) throw new Exception("");
return new Group {Id = group.Id, Name = name1}; return new Group {Id = group.Id, Name = name1};
} }
public GroupLocalEntity AddGroup(String name, String id)
{
return _repositoryGroupImpl.AddGroup(name, id);
}
} }
} }

View File

@ -26,10 +26,18 @@ namespace Posechaemost.UI
} }
public void UpdateGroupName(String name, String name1) { public void UpdateGroupName(String name, String name1) {
StringBuilder userOutput = new StringBuilder(); StringBuilder groupOutput = new StringBuilder();
var group = _groupUseCase.UpdateGroupName(name, name1); var group = _groupUseCase.UpdateGroupName(name, name1);
userOutput.AppendLine($"{group.Id}\t{group.Name}"); groupOutput.AppendLine($"{group.Id}\t{group.Name}");
Console.WriteLine(userOutput); Console.WriteLine(groupOutput);
}
public void AddGroup(String name, String id)
{
StringBuilder groupOutput = new StringBuilder();
var group = _groupUseCase.AddGroup(name, id);
groupOutput.AppendLine($"{group.Id}\t{group.Name}");
Console.WriteLine(groupOutput);
} }
} }
} }

View File

@ -34,6 +34,7 @@ namespace Posechaemost.UI
case "4": _userConsoleUI.GetUserByGuid(Guid.Parse(Console.ReadLine())); break; case "4": _userConsoleUI.GetUserByGuid(Guid.Parse(Console.ReadLine())); break;
case "5": _userConsoleUI.UpdateUserByGuid(Guid.Parse(Console.ReadLine()), Console.ReadLine(), 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(); default: DisplayMenu();
break; break;

Binary file not shown.

Binary file not shown.

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Posechaemost")] [assembly: System.Reflection.AssemblyCompanyAttribute("Posechaemost")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2adf9afa836f2195e7d6875eb60914f8f6544ee9")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+1305f40f241ce752d3c0a7ec5341b1eafac497d8")]
[assembly: System.Reflection.AssemblyProductAttribute("Posechaemost")] [assembly: System.Reflection.AssemblyProductAttribute("Posechaemost")]
[assembly: System.Reflection.AssemblyTitleAttribute("Posechaemost")] [assembly: System.Reflection.AssemblyTitleAttribute("Posechaemost")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
96bf08b88313635c8c7dfa5999c9c749997058383865f8a634f20c197c546273 7a59f60438c72dd05578b09f953c9ba9d3343469014f076958deeba098123188

Binary file not shown.

Binary file not shown.