public async Task <RespContainer <ArticleTypeResponse> > Handle(AddArticleTypeCommand request, CancellationToken cancellationToken) { Models.ArticleType articleType = _articleTypeMapper.Map(request.Data); Models.ArticleType result = _articleTypeRespository.Add(articleType); int modifiedRecords = await _articleTypeRespository.UnitOfWork.SaveChangesAsync(); _logger.LogInformation(Events.Add, Messages.NumberOfRecordAffected_modifiedRecords, modifiedRecords); _logger.LogInformation(Events.Add, Messages.ChangesApplied_id, result?.Id); return(RespContainer.Ok(_articleTypeMapper.Map(result), "ArticleType Created")); }
public ArticleResponse Map(Article article) { if (article == null) { return(null); } ; ArticleResponse response = new ArticleResponse { Id = article.Id, Name = article.Name, MaterialType = article.MaterialType, IsArchived = article.IsArchived, IsDiscontinued = article.IsDiscontinued, IsBatch = article.IsBatch, IsMultistock = article.IsMultistock, IsProvisionEnabled = article.IsProvisionEnabled, IsDiscountEnabled = article.IsDiscountEnabled, IsDisposition = article.IsDisposition, IsCasting = article.IsCasting, ScaleUnitQty = article.ScaleUnitQty, ScaleUnitType = article.ScaleUnitType, UnitStock = article.UnitStock, UnitStockIn = article.UnitStockIn, UnitStockOut = article.UnitStockOut, DimArea = article.DimArea, DimLength = article.DimLength, Dim2 = article.Dim2, Dim3 = article.Dim3, Dim4 = article.Dim4, SpecificWeight = article.SpecificWeight, ItemNumber = article.ItemNumber, DrawingNumber = article.DrawingNumber, DinNorm1 = article.DinNorm1, DinNorm2 = article.DinNorm2, ArticleGroupId = article.ArticleGroupId, ArticleGroup = _articleGroupMapper.Map(article.ArticleGroup), ArticleTypeId = article.ArticleTypeId, ArticleType = _articleTypeMapper.Map(article.ArticleType), ArticleInventories = article.ArticleInventories.Select(x => _articleInventoryMapper.Map(x)).ToList(), ArticleRanges = article.ArticleRanges.Select(x => _articleRangeMapper.Map(x)).ToList(), Pictures = article.Pictures.Select(x => _fagBinaryMapper.Map(x)).ToList() }; return(response); }
public async Task <ArticleTypeResponse> AddArticleTypeAsync(AddArticleTypeRequest request) { ArticleType articleType = _articleTypeMapper.Map(request); ArticleType result = _articleTypeRespository.Add(articleType); int modifiedRecords = await _articleTypeRespository.UnitOfWork.SaveChangesAsync(); _logger.LogInformation(Events.Add, Messages.NumberOfRecordAffected_modifiedRecords, modifiedRecords); _logger.LogInformation(Events.Add, Messages.ChangesApplied_id, result?.Id); return(_articleTypeMapper.Map(result)); }