예제 #1
0
        public async Task <RespContainer <DocumentPositionResponse> > Handle(AddDocumentPositionCommand request, CancellationToken cancellationToken)
        {
            Models.DocumentPosition documentPosition = _documentPositionMapper.Map(request.Data);
            Models.DocumentPosition result           = _documentPositionRespository.Add(documentPosition);

            int modifiedRecords = await _documentPositionRespository.UnitOfWork.SaveChangesAsync();

            _logger.LogInformation(Events.Add, Messages.NumberOfRecordAffected_modifiedRecords, modifiedRecords);
            _logger.LogInformation(Events.Add, Messages.ChangesApplied_id, result?.Id);

            return(RespContainer.Ok(_documentPositionMapper.Map(result), "DocumentPosition Created"));
        }
예제 #2
0
        public async Task <DocumentPositionResponse> AddDocumentPositionAsync(AddDocumentPositionRequest request)
        {
            DocumentPosition documentPosition = _documentPositionMapper.Map(request);
            DocumentPosition result           = _documentPositionRespository.Add(documentPosition);

            int modifiedRecords = await _documentPositionRespository.UnitOfWork.SaveChangesAsync();

            _logger.LogInformation(Events.Add, Messages.NumberOfRecordAffected_modifiedRecords, modifiedRecords);
            _logger.LogInformation(Events.Add, Messages.ChangesApplied_id, result?.Id);

            return(_documentPositionMapper.Map(result));
        }