public void UpsertProductMarkdown_UpsertsProductMarkdown(string productName, decimal amountOffRetail, DateTime?startTime, DateTime?endTime) { var args = new UpsertProductMarkdownArgs(productName, amountOffRetail, startTime, endTime); var persistedProduct = _productMarkdownConfigurationService.UpsertProductMarkdown(args); persistedProduct.Name.Should().Be(args.ProductName); persistedProduct.Markdown.AmountOffRetail.Should().Be(args.AmountOffRetail); persistedProduct.Markdown.StartTime.Should().Be(args.StartTime.Value); persistedProduct.Markdown.EndTime.Should().Be(args.EndTime.Value); }
public ProductDto UpsertProductMarkdown(UpsertProductMarkdownArgs args) { _upsertProductMarkdownArgsValidator.ValidateAndThrow <UpsertProductMarkdownArgs>(args); var product = _productRepository.FindProduct(args.ProductName); if (product.Markdown == null) { product.Markdown = _mapper.Map <Markdown>(args); } else { _mapper.Map <UpsertProductMarkdownArgs, Markdown>(args, product.Markdown); } var persistedProduct = _productRepository.UpdateProduct(product); return(_mapper.Map <ProductDto>(persistedProduct)); }
public ActionResult <ProductDto> CreateMarkdown(string productName, [FromBody] UpsertProductMarkdownArgs args) { args.ProductName = productName; return(_productMarkdownConfigurationService.UpsertProductMarkdown(args)); }