public async Task <OutProductDTO> CreateProductAsync(InProductDTO inProductDto) { var manufacturingPlan = await _manufacturingPlanRepository.GetById(inProductDto.manufacturingPlan); var product = await _productRepository.Create(ProductMapping.InDtoToProduct(inProductDto, manufacturingPlan)); return(ProductMapping.ProductToOutDto(product)); }
public async Task <OutProductDTO> UpdateProductAsync(int id, InProductDTO inProductDto) { var manufacturingPlan = await _manufacturingPlanRepository.GetById(inProductDto.manufacturingPlan); var product = ProductMapping.InDtoToProduct(inProductDto, manufacturingPlan); product.Id = id; var updatedProduct = await _productRepository.Update(product); return(ProductMapping.ProductToOutDto(updatedProduct)); }