using ReAct_PME.Infrastructure;
using ReAct_PME.Domain;


namespace ReAct_PME.Application
{
    public partial class DT_ROLEService(IDT_ROLERepository dt_roleRepository) : IDT_ROLEService
    {
		#region CRUD de la table DT_ROLE
		public async Task<bool> Create_Async(DT_ROLE_DTO dt_role)
		{
			if (await dt_roleRepository.GetById_Async(dt_role.ID_ROLE) != null)
			{
				return false;
			}
			return await dt_roleRepository.Create_Async(dt_role);
		}

		public async Task<bool> Update_Async(Guid ID_ROLE, DT_ROLE_DTO updatedDT_ROLE)
		{
			return await dt_roleRepository.Update_Async(ID_ROLE, updatedDT_ROLE);
		}

		public async Task<bool> Delete_Async(Guid ID_ROLE)
		{
			return await dt_roleRepository.Delete_Async(ID_ROLE);
		}

		public async Task<IEnumerable<DT_ROLE_DTO>> GetAll_Async(bool IsActifOnly=false)
		{
			return await dt_roleRepository.GetAll_Async(IsActifOnly);
		}

		public async Task<DT_ROLE_DTO?> GetById_Async(Guid ID_ROLE)
		{
			return await dt_roleRepository.GetById_Async(ID_ROLE);
		}

		#endregion



    }
}
