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.
26 lines
915 B
C#
26 lines
915 B
C#
using AutoMapper;
|
|
using DbFirst.Application.Repositories;
|
|
using MediatR;
|
|
using DbFirst.Contracts.MassData;
|
|
|
|
namespace DbFirst.Application.MassData.Commands;
|
|
|
|
public class UpsertMassDataByCustomerNameHandler : IRequestHandler<UpsertMassDataByCustomerNameCommand, MassDataReadDto>
|
|
{
|
|
private readonly IMassDataRepository _repository;
|
|
private readonly IMapper _mapper;
|
|
|
|
public UpsertMassDataByCustomerNameHandler(IMassDataRepository repository, IMapper mapper)
|
|
{
|
|
_repository = repository;
|
|
_mapper = mapper;
|
|
}
|
|
|
|
public async Task<MassDataReadDto> Handle(UpsertMassDataByCustomerNameCommand request, CancellationToken cancellationToken)
|
|
{
|
|
var dto = request.Dto;
|
|
var updated = await _repository.UpsertByCustomerNameAsync(dto.CustomerName, dto.Amount, dto.StatusFlag, dto.Category, cancellationToken);
|
|
return _mapper.Map<MassDataReadDto>(updated);
|
|
}
|
|
}
|