Raspisanie/Zurnal/Date/Repository/UserRepositoryImpl.cs
2024-11-01 10:49:39 +03:00

103 lines
3.0 KiB
C#

using Zurnal.domain.Models;
using Zurnal.Date.LocalDate;
using Zurnal.Date.Repository;
using Zurnal.Domain.UseCase;
namespace Zurnal.Data.Repository
{
public class UserRepositoryImpl : IGroupRepository
{
public UserRepositoryImpl() => GetAllUsers = LocalStaticData.users;
public List<UserLocalEnity> GetAllUsers { get; set; }
public bool RemoveUserByGuid(Guid userGuid)
{
UserLocalEnity? userLocal = GetAllUsers
.Where(x => x.Guid == userGuid)
.FirstOrDefault();
if (userLocal == null) return false;
return GetAllUsers.Remove(userLocal);
}
public UserLocalEnity? GetUserByGuid(Guid userGuid) {
UserLocalEnity? userLocal = GetAllUsers
.Where(x => x.Guid == userGuid).FirstOrDefault();
if (userLocal == null) return null;
return userLocal;
}
public UserLocalEnity? UpdateUser(UserLocalEnity userUpdateLocalEnity) {
UserLocalEnity? userLocal = GetAllUsers
.Where(x => x.Guid == userUpdateLocalEnity.Guid).FirstOrDefault();
if (userLocal == null) return null;
userLocal.FIO = userUpdateLocalEnity.FIO;
userLocal.GroupID = userUpdateLocalEnity.GroupID;
return userLocal;
}
public List<UserLocalEnity> GetAllUsersList()
{
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 List<GroupLocalEntity> AllGroup => throw new NotImplementedException();
internal UserUseCase.UserLocalEntity? UpdateUser(UserUseCase.UserLocalEntity userLocalEntity)
{
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();
}
public void DeleteGroup(int id)
{
throw new NotImplementedException();
}
}
}