This commit is contained in:
Class_Student 2024-11-08 10:51:01 +03:00
commit 14271607f2
4 changed files with 51 additions and 0 deletions

View File

@ -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<GroupLocalEntity> 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;
}
}
}

View File

@ -42,5 +42,9 @@ namespace _123.Domain.UseCase
{
return _repositoryGroupImpl.RemoveGroupById(id);
}
public GroupLocalEntity AddGroup(String name, string id)
{
return _repositoryGroupImpl.AddGroup(name, id);
}
}
}

View File

@ -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
}
}

View File

@ -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;