Developer 02 d6b08c3c30 refactor: CRUD-Services und -Interfaces für alle außer Module und ModuleOfUser von IService und Service vererbt
- Vererbung von IService und Service auf alle CRUD-Services und -Interfaces angewendet, mit Ausnahme von Module und ModuleOfUser.
2024-08-14 19:08:43 +02:00

25 lines
1.2 KiB
C#

using AutoMapper;
using DigitalData.Core.Application;
using DigitalData.Core.DTO;
using DigitalData.UserManager.Application.Contracts;
using DigitalData.UserManager.Application.DTOs.UserRep;
using DigitalData.UserManager.Domain.Entities;
using DigitalData.UserManager.Infrastructure.Contracts;
using Microsoft.Extensions.Localization;
namespace DigitalData.UserManager.Application.Services
{
public class UserRepService : BaseService<IUserRepRepository, UserRepCreateDto, UserRepReadDto, UserRepUpdateDto, UserRep>, IUserRepService
{
public UserRepService(IUserRepRepository repository, IStringLocalizer<Resource> localizer, IMapper mapper) : base(repository, mapper)
{
}
public async Task<DataResult<IEnumerable<UserRepReadDto>>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withRightGroup = false, bool withRepUser = false, int? userId = null)
{
var urs = await _repository.ReadAllAsync(withUser, withRepGroup, withRightGroup, withRepUser, userId);
var urReadDTOs = _mapper.MapOrThrow<IEnumerable<UserRepReadDto>>(urs);
return Result.Success(urReadDTOs);
}
}
}