public DocumentPositionResponse Map(DocumentPosition documentPosition) { if (documentPosition == null) { return(null); } ; DocumentPositionResponse response = new DocumentPositionResponse { Id = documentPosition.Id, PositionNumberText = documentPosition.PositionNumberText, ArticleNameExtern = documentPosition.ArticleNameExtern, Quantity = documentPosition.Quantity, ScaleUnitQty = documentPosition.ScaleUnitQty, ScaleUnitType = documentPosition.ScaleUnitType, ScaleUnit = documentPosition.ScaleUnit, DeliveryQty = documentPosition.DeliveryQty, IsPartialDelivered = documentPosition.IsPartialDelivered, PriceBase = documentPosition.PriceBase, PricePerUnit = documentPosition.PricePerUnit, PriceTotal = documentPosition.PricePerUnit, SalesTaxPercent = documentPosition.SalesTaxPercent, ParentId = (Guid)documentPosition.ParentId, Parent = _documentPositionMapper.Map(documentPosition.Parent), DocumentId = documentPosition.DocumentId, Document = _documentMapper.Map(documentPosition.Document), ArticleId = documentPosition.ArticleId, Article = _articleMapper.Map(documentPosition.Article), }; return(response); }
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")); }
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)); }