Refactored DTO class and namespace names from Massdata* to MassData* in DbFirst.Contracts. Updated all relevant application files to use the correct DTO namespaces for Catalogs and MassData. Adjusted _Imports.razor to include new DTO namespaces and removed unused usings. These changes improve code consistency and reduce namespace-related errors.
25 lines
775 B
C#
25 lines
775 B
C#
using AutoMapper;
|
|
using DbFirst.Application.Repositories;
|
|
using MediatR;
|
|
using DbFirst.Contracts.Catalogs;
|
|
|
|
namespace DbFirst.Application.Catalogs.Queries;
|
|
|
|
public class GetCatalogByIdHandler : IRequestHandler<GetCatalogByIdQuery, CatalogReadDto?>
|
|
{
|
|
private readonly ICatalogRepository _repository;
|
|
private readonly IMapper _mapper;
|
|
|
|
public GetCatalogByIdHandler(ICatalogRepository repository, IMapper mapper)
|
|
{
|
|
_repository = repository;
|
|
_mapper = mapper;
|
|
}
|
|
|
|
public async Task<CatalogReadDto?> Handle(GetCatalogByIdQuery request, CancellationToken cancellationToken)
|
|
{
|
|
var item = await _repository.GetByIdAsync(request.Id, cancellationToken);
|
|
return item == null ? null : _mapper.Map<CatalogReadDto>(item);
|
|
}
|
|
}
|