using AutoMapper; using DbFirst.Application.Repositories; using MediatR; namespace DbFirst.Application.MassData.Commands; public class UpsertMassDataByCustomerNameHandler : IRequestHandler { private readonly IMassDataRepository _repository; private readonly IMapper _mapper; public UpsertMassDataByCustomerNameHandler(IMassDataRepository repository, IMapper mapper) { _repository = repository; _mapper = mapper; } public async Task 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(updated); } }