43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using Demo.Data.LocalData;
|
|
using Demo.domain.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Demo.Data.Repository
|
|
{
|
|
public class UserRepositoryImpl
|
|
{
|
|
|
|
public List<UserLocalEnity> GetAllUsers = new List<UserLocalEnity>();
|
|
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;
|
|
|
|
}
|
|
}
|
|
}
|