public async Task <ArticlePriceListOutResponse> EditArticlePriceListOutAsync(EditArticlePriceListOutRequest request) { ArticlePriceListOut existingRecord = await _articlePriceListOutRespository.GetAsync(request.Id); if (existingRecord == null) { throw new ArgumentException($"Entity with {request.Id} is not present"); } if (request.ArticleId != null) { Article existingArticle = await _articleRespository.GetAsync(request.ArticleId); if (existingArticle == null) { throw new NotFoundException($"Article with {request.ArticleId} is not present"); } } ArticlePriceListOut entity = _articlePriceListOutMapper.Map(request); ArticlePriceListOut result = _articlePriceListOutRespository.Update(entity); int modifiedRecords = await _articlePriceListOutRespository.UnitOfWork.SaveChangesAsync(); _logger.LogInformation(Logging.Events.Edit, Messages.NumberOfRecordAffected_modifiedRecords, modifiedRecords); _logger.LogInformation(Logging.Events.Edit, Messages.ChangesApplied_id, result?.Id); return(_articlePriceListOutMapper.Map(result)); }
public ArticlePriceListOut Map(EditArticlePriceListOutRequest request) { if (request == null) { return(null); } ArticlePriceListOut articlePriceListOut = new ArticlePriceListOut { Id = request.Id, Priority = request.Priority, ReorderTime = request.ReorderTime, ScaleUnitQty = request.ScaleUnitQty, ScaleUnitType = request.ScaleUnitType, UnitOrder = request.UnitOrder, MinOrderQty = request.MinOrderQty, IsMultipleOrderQty = request.IsMultipleOrderQty, ArticleId = request.ArticleId, }; return(articlePriceListOut); }