2024-10-21 12:41:56 +00:00
|
|
|
|
using Demo.Data.Exceptions;
|
|
|
|
|
using Demo.Data.LocalData;
|
2024-10-25 08:47:11 +00:00
|
|
|
|
using Demo.Data.RemoteData.RemoteDataBase.DAO;
|
2024-10-21 12:41:56 +00:00
|
|
|
|
using Demo.domain.Models;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace Demo.Data.Repository
|
|
|
|
|
{
|
2024-10-28 12:03:51 +00:00
|
|
|
|
public class UserRepositoryImpl
|
2024-10-21 12:41:56 +00:00
|
|
|
|
{
|
|
|
|
|
private List<UserLocalEnity> _users;
|
|
|
|
|
|
|
|
|
|
public UserRepositoryImpl()
|
|
|
|
|
{
|
|
|
|
|
_users = LocalStaticData.users;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IEnumerable<UserLocalEnity> GetAllUsers => _users;
|
|
|
|
|
|
2024-10-25 08:47:11 +00:00
|
|
|
|
|
2024-10-21 12:41:56 +00:00
|
|
|
|
public bool RemoveUserById(int userId)
|
|
|
|
|
{
|
|
|
|
|
var user = _users.FirstOrDefault(u => u.ID == userId);
|
|
|
|
|
if (user == null) throw new UserNotFoundException(userId);
|
|
|
|
|
|
|
|
|
|
_users.Remove(user);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-28 12:03:51 +00:00
|
|
|
|
public UserDao? UpdateUser(UserDao user)
|
2024-10-25 08:47:11 +00:00
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
2024-10-21 12:41:56 +00:00
|
|
|
|
}
|
|
|
|
|
}
|