Raspisanie/Zurnal/Date/Repository/UserRepositoryImpl.cs
2024-10-25 12:20:05 +03:00

106 lines
3.0 KiB
C#

using Zurnal.domain.Models;
using Zurnal.Date.LocalDate;
using Zurnal.Date.Repository;
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 GetAllUsersList;
}
List<GroupLocalEntity> IGroupRepository.GetAllGroups()
{
throw new NotImplementedException();
}
bool IGroupRepository.RemoveGroupById(int groupID)
{
throw new NotImplementedException();
}
bool IGroupRepository.UpdateGroupById(int groupID, GroupLocalEntity updatedGroup)
{
throw new NotImplementedException();
}
GroupLocalEntity IGroupRepository.GetGroupById(int groupID)
{
throw new NotImplementedException();
}
bool IGroupRepository.AddGroup(GroupLocalEntity newGroup)
{
throw new NotImplementedException();
}
internal object GetAllUsers()
{
throw new NotImplementedException();
}
public void AddGroup(System.Text.RegularExpressions.Group group)
{
throw new NotImplementedException();
}
public System.Text.RegularExpressions.Group GetGroupById(int id)
{
throw new NotImplementedException();
}
public IEnumerable<System.Text.RegularExpressions.Group> GetAllGroups()
{
throw new NotImplementedException();
}
public void UpdateGroup(System.Text.RegularExpressions.Group group)
{
throw new NotImplementedException();
}
public void DeleteGroup(int id)
{
throw new NotImplementedException();
}
public object GetAllGroup()
{
throw new NotImplementedException();
}
}
}