2024-11-25 04:33:26 +00:00
|
|
|
|
using Demo.Data.Repository;
|
|
|
|
|
using Demo.Data.RemoteData.RemoteDataBase.DAO;
|
|
|
|
|
using System;
|
2024-10-24 08:50:32 +00:00
|
|
|
|
using System.Collections.Generic;
|
2024-10-21 22:57:01 +00:00
|
|
|
|
|
2024-10-28 12:42:04 +00:00
|
|
|
|
namespace Demo.Domain.UseCase
|
2024-10-21 22:57:01 +00:00
|
|
|
|
{
|
|
|
|
|
public class UserUseCase
|
|
|
|
|
{
|
2024-10-24 08:50:32 +00:00
|
|
|
|
private readonly IUserRepository _userRepository;
|
2024-10-21 22:57:01 +00:00
|
|
|
|
|
2024-10-24 08:50:32 +00:00
|
|
|
|
public UserUseCase(IUserRepository userRepository)
|
2024-10-21 22:57:01 +00:00
|
|
|
|
{
|
|
|
|
|
_userRepository = userRepository;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-25 04:33:26 +00:00
|
|
|
|
public IUserRepository UserRepository => _userRepository;
|
2024-10-24 08:50:32 +00:00
|
|
|
|
|
2024-11-25 04:33:26 +00:00
|
|
|
|
public IEnumerable<User> GetAllUsers()
|
2024-10-24 08:50:32 +00:00
|
|
|
|
{
|
2024-11-25 04:33:26 +00:00
|
|
|
|
return _userRepository.GetAllUsers();
|
2024-10-24 08:50:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-11-25 04:33:26 +00:00
|
|
|
|
public User GetUserById(Guid id)
|
2024-10-24 08:50:32 +00:00
|
|
|
|
{
|
2024-10-28 12:42:04 +00:00
|
|
|
|
return _userRepository.GetUserById(id);
|
2024-10-24 08:50:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-11-25 04:33:26 +00:00
|
|
|
|
public void UpdateUser(User user)
|
2024-10-24 08:50:32 +00:00
|
|
|
|
{
|
2024-11-25 04:33:26 +00:00
|
|
|
|
_userRepository.UpdateUser(user);
|
2024-10-24 08:50:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2024-11-25 04:33:26 +00:00
|
|
|
|
public void DeleteUser(Guid id)
|
2024-10-24 08:50:32 +00:00
|
|
|
|
{
|
2024-11-25 04:33:26 +00:00
|
|
|
|
_userRepository.DeleteUser(id);
|
2024-10-24 08:50:32 +00:00
|
|
|
|
}
|
2024-10-21 22:57:01 +00:00
|
|
|
|
}
|
2024-11-25 04:33:26 +00:00
|
|
|
|
}
|