This commit is contained in:
Userok 2024-11-02 13:59:07 +03:00
parent 34ff2ea057
commit e86bec8a7f
7 changed files with 58 additions and 185 deletions

View File

@ -1,5 +1,4 @@
using System.Diagnostics; using System.Diagnostics;
using Zurnal.Date.Repository;
using Zurnal.RemaDateBase.DateDao; using Zurnal.RemaDateBase.DateDao;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -73,22 +72,6 @@ public bool UpdateGroupById(int groupId, GroupDao updatedGroup)
GroupDao.Name.Remove(group); GroupDao.Name.Remove(group);
} }
} }
bool IGroupRepository.AddGroup(GroupDao newGroup)
{
throw new NotImplementedException();
}
public void AddGroupFromRegex(Group group)
{
throw new NotImplementedException();
}
public GroupDao GetGroupById(int id)
{
throw new NotImplementedException();
}
public void UpdateGroup(GroupDao group) public void UpdateGroup(GroupDao group)
{ {
throw new NotImplementedException(); throw new NotImplementedException();

View File

@ -1,65 +1,65 @@
using Zurnal.RemaDateBase.DateDao; using Zurnal.RemaDateBase.DateDao;
using Microsoft.Extensions.DependencyInjection;
using Group = System.Text.RegularExpressions.Group;
namespace Zurnal.Date.Repository internal interface IGroupRepository
{ {
internal interface IGroupRepository List<GroupDao> AllGroup { get; }
{
List<GroupDao> AllGroup { get; }
public IEnumerable<GroupDao> AllGroups() public IEnumerable<GroupDao> AllGroups()
{
return GroupDao.Name.Select(g => new GroupDao { GroupName = g.GroupName, Id = g.Id });
}
public bool RemoveGroupById(int groupId)
{
var group = GroupDao.Name.FirstOrDefault(g => g.Id == groupId);
if (group != null)
{
GroupDao.Name.Remove(group);
return true;
}
return false;
}
public bool UpdateGroupById(int groupId, GroupDao updatedGroup)
{
var group = GroupDao.Name.FirstOrDefault(g => g.Id == groupId);
if (group != null)
{ {
group.GroupName = updatedGroup.GroupName; return AllGroup.Select(g => new GroupDao { GroupName = g.GroupName, Id = g.Id });
return true;
}
return false;
}
public void DeleteGroup(int id)
{
var group = GroupDao.Name.FirstOrDefault(g => g.Id == id);
if (group != null)
{
GroupDao.Name.Remove(group);
}
}
void AddGroupFromRegex(Group group);
public GroupDao GetGroupById(int id);
IEnumerable<GroupDao> GetAllGroups();
public void UpdateGroupName(int groupId, string name)
{
var group = GroupDao.Name.FirstOrDefault(g => g.Id == groupId);
if (group != null)
{
group.GroupName = name;
}
}
} }
internal class ServiceConfiguration public bool RemoveGroupById(int groupId)
{ {
public static void ConfigureServices(IServiceCollection services) var group = AllGroup.FirstOrDefault(g => g.Id == groupId);
if (group != null)
{ {
services.AddDbContext<RemoteDateBaseContext>() AllGroup.Remove(group);
.AddScoped<IGroupRepository>(); return true;
}
return false;
}
public GroupDao FindGroupById(int groupId)
{
return AllGroup.FirstOrDefault(g => g.Id == groupId);
}
public bool UpdateGroupById(int groupId, GroupDao updatedGroup)
{
if (updatedGroup == null) throw new ArgumentNullException(nameof(updatedGroup));
var group = AllGroup.FirstOrDefault(g => g.Id == groupId);
if (group != null)
{
group.GroupName = updatedGroup.GroupName;
return true;
}
return false;
}
public void DeleteGroup(int id)
{
var group = AllGroup.FirstOrDefault(g => g.Id == id);
if (group != null)
{
AllGroup.Remove(group);
}
}
public IEnumerable<GroupDao> GetAllGroups()
{
return AllGroup;
}
public void UpdateGroupName(int groupId, string name)
{
if (name == null) throw new ArgumentNullException(nameof(name));
var group = AllGroup.FirstOrDefault(g => g.Id == groupId);
if (group != null)
{
group.GroupName = name;
} }
} }
} }

View File

@ -1,6 +1,5 @@
using Zurnal.domain.Models; using Zurnal.domain.Models;
using Zurnal.Date.LocalDate; using Zurnal.Date.LocalDate;
using Zurnal.Date.Repository;
using Zurnal.Domain.UseCase; using Zurnal.Domain.UseCase;
using Zurnal.RemaDateBase.DateDao; using Zurnal.RemaDateBase.DateDao;
@ -12,6 +11,8 @@ namespace Zurnal.Data.Repository
public List<UserLocalEnity> GetAllUsers { get; set; } public List<UserLocalEnity> GetAllUsers { get; set; }
public List<GroupDao> AllGroup => throw new NotImplementedException();
public bool RemoveUserByGuid(Guid userGuid) public bool RemoveUserByGuid(Guid userGuid)
{ {
UserLocalEnity? userLocal = GetAllUsers UserLocalEnity? userLocal = GetAllUsers
@ -43,84 +44,5 @@ namespace Zurnal.Data.Repository
{ {
return GetAllUsers; return GetAllUsers;
} }
public List<GroupLocalEntity> GetAllGroups()
{
throw new NotImplementedException();
}
public bool RemoveGroupById(int groupID)
{
throw new NotImplementedException();
}
public bool UpdateGroupById(int groupID, GroupLocalEntity updatedGroup)
{
throw new NotImplementedException();
}
public GroupLocalEntity GetGroupById(int groupID)
{
throw new NotImplementedException();
}
public bool AddGroup(GroupLocalEntity newGroup)
{
throw new NotImplementedException();
}
public IEnumerable<System.Text.RegularExpressions.Group> AllGroups()
{
throw new NotImplementedException();
}
public bool UpdateGroupById(int groupID, GroupDao updatedGroup)
{
throw new NotImplementedException();
}
public bool AddGroup(GroupDao newGroup)
{
throw new NotImplementedException();
}
public void AddGroupFromRegex(System.Text.RegularExpressions.Group group)
{
throw new NotImplementedException();
}
GroupDao IGroupRepository.GetGroupById(int id)
{
throw new NotImplementedException();
}
IEnumerable<GroupDao> IGroupRepository.GetAllGroups()
{
throw new NotImplementedException();
}
public void UpdateGroup(GroupDao group)
{
throw new NotImplementedException();
}
public void DeleteGroup(int id)
{
throw new NotImplementedException();
}
internal UserUseCase.UserLocalEntity? UpdateUser(UserUseCase.UserLocalEntity userLocalEntity)
{
throw new NotImplementedException();
}
IEnumerable<GroupDao> IGroupRepository.AllGroups()
{
throw new NotImplementedException();
}
public List<GroupLocalEntity> AllGroup => throw new NotImplementedException();
List<GroupDao> IGroupRepository.AllGroup => throw new NotImplementedException();
} }
} }

View File

@ -1,16 +1,14 @@
using System.Text.RegularExpressions;
using Zurnal.Data.Repository; using Zurnal.Data.Repository;
using Zurnal.Date.Repository;
using Zurnal.RemaDateBase.DateDao; using Zurnal.RemaDateBase.DateDao;
namespace Zurnal.Domain.UseCase namespace Zurnal.Domain.UseCase
{ {
public class GroupUseCase : IGroupRepository public class GroupUseCase : IGroupRepository
{ {
private List<GroupDao> _groups = new List<GroupDao>(); private List<GroupDao> _groups = new List<GroupDao>();
public List<GroupDao> AllGroup => _groups;
private UserRepositoryImpl _repositoryUserImpl; private UserRepositoryImpl _repositoryUserImpl;
private GroupRepositoryImpl _repositoryGroupImpl; private GroupRepositoryImpl _repositoryGroupImpl;
public List<GroupDao> AllGroup => throw new NotImplementedException();
public List<GroupDao> GetAllGroups() => _repositoryGroupImpl.GetAllGroups() public List<GroupDao> GetAllGroups() => _repositoryGroupImpl.GetAllGroups()
@ -48,10 +46,6 @@ namespace Zurnal.Domain.UseCase
return true; return true;
} }
public bool UpdateGroupById(int groupID, GroupDao updatedGroup)
{
throw new NotImplementedException();
}
IEnumerable<GroupDao> IGroupRepository.GetAllGroups() IEnumerable<GroupDao> IGroupRepository.GetAllGroups()
{ {
@ -60,35 +54,10 @@ namespace Zurnal.Domain.UseCase
.ToList(); .ToList();
} }
public void AddGroupFromRegex(System.Text.RegularExpressions.Group group)
{
throw new NotImplementedException();
}
public GroupDao GetGroupById(int id) public GroupDao GetGroupById(int id)
{ {
return _groups.FirstOrDefault(g => g.Id == id); return _groups.FirstOrDefault(g => g.Id == id);
} }
public void UpdateGroup(GroupDao group)
{
throw new NotImplementedException();
}
public void DeleteGroup(int id)
{
throw new NotImplementedException();
}
IEnumerable<Group> IGroupRepository.AllGroups()
{
throw new NotImplementedException();
}
bool IGroupRepository.AddGroup(GroupDao newGroup)
{
throw new NotImplementedException();
}
} }
} }

View File

@ -1,5 +1,4 @@
using Zurnal.Data.Repository; using Zurnal.Data.Repository;
using Zurnal.Date.Repository;
using Zurnal.RemaDateBase.DateDao; using Zurnal.RemaDateBase.DateDao;
namespace Zurnal.Domain.UseCase namespace Zurnal.Domain.UseCase

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Zurnal")] [assembly: System.Reflection.AssemblyCompanyAttribute("Zurnal")]
[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+6882444548100e8c025d9e78806599aa8bb318a3")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+34ff2ea057283cd78eb7b49bd26432b8fed15732")]
[assembly: System.Reflection.AssemblyProductAttribute("Zurnal")] [assembly: System.Reflection.AssemblyProductAttribute("Zurnal")]
[assembly: System.Reflection.AssemblyTitleAttribute("Zurnal")] [assembly: System.Reflection.AssemblyTitleAttribute("Zurnal")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
9dff231535641cdfc92aca08ac3ded2ec8946da291a33bf90e9cc5f880b09a03 0df9278f60a66dc8e6fa4dcbb3c724fa603d832d40511f5c21919f1d6dd33202