Raspisanie/Zurnal/Date/Repository/UserRepositoryImpl.cs

72 lines
2.1 KiB
C#
Raw Normal View History

2024-10-23 08:14:10 +00:00
using Zurnal.domain.Models;
2024-10-21 11:56:16 +00:00
using Zurnal.Date.LocalDate;
using Zurnal.Date.Repository;
2024-10-23 08:14:10 +00:00
namespace Zurnal.Data.Repository
2024-10-21 11:56:16 +00:00
{
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;
}
List<GroupLocalEntity> IGroupRepository.GetAllGroup()
{
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();
}
}
}