using Demo.Domain.Models; using Demo.Data.LocalData; namespace Demo.Data.Repository { public class UserRepositoryImpl : IUserRepository { public UserRepositoryImpl() { GetAllUsers = LocalStaticData.users; } public List GetAllUsers { get; set; } public List GetAllUser(){ return GetAllUsers; } public bool RemoveUserByGuid(Guid userGuid) { UserLocalEntity? userLocal = GetAllUsers .Where(x => x.Guid == userGuid).FirstOrDefault(); if (userLocal == null) return false; return GetAllUsers.Remove(userLocal); } public UserLocalEntity? GetUserById(Guid userGuid) { UserLocalEntity? userlocal = LocalStaticData.users.Where(x => x.Guid == userGuid).FirstOrDefault(); if (userlocal == null) return null; return userlocal; } public UserLocalEntity? UpdateUserById(UserLocalEntity userUpdateLocalEntity) { int index = GetAllUsers.FindIndex(x => x.Guid == userUpdateLocalEntity.Guid); if (index == -1) return null; GetAllUsers[index].FIO = userUpdateLocalEntity.FIO; GetAllUsers[index].GroupID = userUpdateLocalEntity.GroupID; Console.WriteLine($"Обновленный FIO: {GetAllUsers[index].FIO}, GroupID: {GetAllUsers[index].GroupID}"); return GetAllUsers[index]; } } }