This commit is contained in:
parent
d72fa80379
commit
d8b97b4d47
@ -1,83 +1,117 @@
|
||||
using Zurnal.domain.Models;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Zurnal.Date.LocalDate;
|
||||
using Zurnal.Date.Repository;
|
||||
using Zurnal.RemaDateBase.DateDao;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Zurnal.Data.Repository
|
||||
{
|
||||
[DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)}(),nq}}")]
|
||||
public class GroupRepositoryImpl : IGroupRepository
|
||||
{
|
||||
public List<GroupLocalEntity> GetAllGroups() => LocalStaticData.groups;
|
||||
public List<GroupDao> AllGroup => GroupDao.Name.ToList();
|
||||
|
||||
public void AddGroup(GroupLocalEntity newGroup)
|
||||
public IEnumerable<GroupDao> GetAllGroups()
|
||||
{
|
||||
LocalStaticData.groups.Add(newGroup);
|
||||
return GroupDao.Name;
|
||||
}
|
||||
|
||||
public void UpdateGroupName(int groupId, string newName)
|
||||
{
|
||||
var group = LocalStaticData.groups.FirstOrDefault(g => g.Id == groupId);
|
||||
if (group != null)
|
||||
{
|
||||
group.Name = newName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public GroupLocalEntity GetGroupById(int groupId)
|
||||
public void AddGroup(GroupDao group)
|
||||
{
|
||||
return LocalStaticData.groups.FirstOrDefault(g => g.Id == groupId);
|
||||
if (group == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(group));
|
||||
}
|
||||
GroupDao.Name.Add(group);
|
||||
}
|
||||
|
||||
public void UpdateGroupName(int groupId, string name)
|
||||
{
|
||||
var group = GroupDao.Name.FirstOrDefault(g => g.Id == groupId);
|
||||
if (group != null)
|
||||
{
|
||||
group.Name = name;
|
||||
}
|
||||
}
|
||||
|
||||
public GroupDao GetGroupById(int id)
|
||||
{
|
||||
return GroupDao.groups.FirstOrDefault(g => g.Id == id);
|
||||
}
|
||||
|
||||
private static string GetDebuggerDisplay()
|
||||
{
|
||||
return $"GroupRepository with {LocalStaticData.groups.Count} groups";
|
||||
return $"GroupRepository with {GroupDao.groups.Count} groups";
|
||||
}
|
||||
|
||||
internal void AddGroup(Group group)
|
||||
public bool RemoveGroupById(int groupId)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var group = GroupDao.groups.FirstOrDefault(g => g.Id == groupId);
|
||||
if (group != null)
|
||||
{
|
||||
GroupDao.groups.Remove(group);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<GroupLocalEntity> AllGroup => throw new NotImplementedException();
|
||||
|
||||
public bool RemoveGroupById(int groupID)
|
||||
public IEnumerable<GroupDao> AllGroups()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return GroupDao.groups.Select(g => new GroupDao { GroupName = g.Name, Id = g.Id });
|
||||
}
|
||||
|
||||
public bool UpdateGroupById(int groupID, GroupLocalEntity updatedGroup)
|
||||
public bool UpdateGroupById(int groupId, GroupDao updatedGroup)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var group = GroupDao.groups.FirstOrDefault(g => g.Id == groupId);
|
||||
if (group != null)
|
||||
{
|
||||
group.Name = updatedGroup.GroupName;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IGroupRepository.AddGroup(GroupLocalEntity newGroup)
|
||||
public void UpdateGroup(GroupDao group)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void AddGroupFromRegex(System.Text.RegularExpressions.Group group)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
System.Text.RegularExpressions.Group IGroupRepository.GetGroupById(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
IEnumerable<System.Text.RegularExpressions.Group> IGroupRepository.GetAllGroups()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void UpdateGroup(System.Text.RegularExpressions.Group group)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var existingGroup = GroupDao.groups.FirstOrDefault(g => g.Id == group.Id);
|
||||
if (existingGroup != null)
|
||||
{
|
||||
existingGroup.Name = group.GroupName;
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteGroup(int id)
|
||||
{
|
||||
var group = GroupDao.groups.FirstOrDefault(g => g.Id == id);
|
||||
if (group != null)
|
||||
{
|
||||
GroupDao.groups.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<Group> IGroupRepository.AllGroups()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void AddGroupFromRegex(Group group)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@ -2,7 +2,9 @@
|
||||
{
|
||||
public class GroupDao
|
||||
{
|
||||
public int Id { get; set; }
|
||||
internal static IEnumerable<GroupDao> Name;
|
||||
|
||||
public int Id { get; set; }
|
||||
public required string GroupName { get; set; }
|
||||
public IEnumerable<UserDao> Users { get; set; }
|
||||
}
|
||||
|
@ -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+f21c9eea749518815b6e31d670ea46d546ea1377")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d72fa803793c5d114c3eabb8fe2de04cd2042db1")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Zurnal")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Zurnal")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
@ -1 +1 @@
|
||||
1914265bd793edbfbb26abfea7e619e59449b0884ab15982620c0f061967d422
|
||||
7af827faec1f5dd576cc86e70a9c41ec992b431c5545340778b3dec093fd4ac1
|
||||
|
@ -1 +1 @@
|
||||
6c6720db556a4418cad2bec16d4d434fb3bb5d14252123bfac524503f5ff6976
|
||||
284ebdeb3fab184734b12e3b8ba05c6bb9ebc0011e646a87edcca3ea143abd87
|
||||
|
9
Zurnal/tempCodeRunnerFile.cs
Normal file
9
Zurnal/tempCodeRunnerFile.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using Zurnal.UI;
|
||||
using Zurnal.Data.Repository;
|
||||
using Zurnal.Domain.UseCase;
|
||||
|
||||
GroupRepositoryImpl groupRepositoryImpl = new GroupRepositoryImpl();
|
||||
UserRepositoryImpl userRepositoryImpl = new UserRepositoryImpl();
|
||||
UserUseCase userUseCase = new UserUseCase(userRepositoryImpl, groupRepositoryImpl);
|
||||
|
||||
MainMenuUI mainMenuUI = new MainMenuUI(userUseCase);
|
Loading…
Reference in New Issue
Block a user