presense/Demo/Domain/UseCase/UserUseCase.cs

45 lines
1.2 KiB
C#
Raw Normal View History

2024-10-14 11:19:48 +00:00
using Demo.Data.Repository;
2024-10-18 13:23:16 +00:00
using Demo.Domain.Models;
2024-10-14 11:19:48 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2024-10-18 13:23:16 +00:00
public class UserUseCase
2024-10-14 11:19:48 +00:00
{
2024-10-18 13:23:16 +00:00
private List<User> _users = new List<User>();
private UserRepositoryImpl userRepositoryImpl;
private GroupRepositoryImpl groupRepositoryImpl;
public UserUseCase(UserRepositoryImpl userRepositoryImpl, GroupRepositoryImpl groupRepositoryImpl)
{
this.userRepositoryImpl = userRepositoryImpl;
this.groupRepositoryImpl = groupRepositoryImpl;
}
public IEnumerable<User> GetAllUsers() => _users;
public User FindUserByGuid(Guid id) => _users.FirstOrDefault(u => u. Guid == id);
public void DeleteUserByGuid(Guid id)
{
var user = _users.FirstOrDefault(u => u.Guid == id);
if (user != null)
_users.Remove(user);
}
public void UpdateUserByGuid(Guid id, string newName)
{
var user = _users.FirstOrDefault(u => u.Guid == id);
if (user != null)
user.FIO = newName;
}
internal bool RemoveUserByGuid(Guid guidUser)
2024-10-14 11:19:48 +00:00
{
2024-10-18 13:23:16 +00:00
throw new NotImplementedException();
2024-10-14 11:19:48 +00:00
}
}