using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; using Posechaemost.Data.LocalData; using Posechaemost.Data.LocalData.Entity; namespace Posechaemost.Data.Repository { public class UserRepositoryImpl { public UserRepositoryImpl() { GetAllUsers = LocalStaticData.users; } public List GetAllUsers { get; set; } 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? GetUserByGuid(Guid userGuid) { UserLocalEntity? userLocal = GetAllUsers .Where(x => x.Guid == userGuid).FirstOrDefault(); if (userLocal == null) return null; return userLocal; } public UserLocalEntity? UpdateUser(UserLocalEntity userUpdateLocalEnity) { UserLocalEntity? userLocal = GetAllUsers .Where(x => x.Guid == userUpdateLocalEnity.Guid).FirstOrDefault(); if (userLocal == null) return null; userLocal.FIO = userUpdateLocalEnity.FIO; userLocal.GroupID = userUpdateLocalEnity.GroupID; return userLocal; } } }