Beispiel #1
0
        public GetProductsOutput UpdateProducts(UpdateProductsInput input)
        {
            var productDtos = this.PerformUpdateObjects<List<ProductDto>, ProductDto, Product>(input.Products,
                _productRepository,
                pdto => pdto.Id.ToString(),
                (p, pdto) =>
                {
                    if (!string.IsNullOrEmpty(pdto.Description))
                        p.Description = pdto.Description;
                    if (!string.IsNullOrEmpty(pdto.ImageUrl))
                        p.ImageUrl = pdto.ImageUrl;
                    if (!string.IsNullOrEmpty(pdto.Name))
                        p.Name = pdto.Name;
                    if (pdto.IsNew != null)
                        p.IsNew = pdto.IsNew.Value;
                    if (pdto.UnitPrice != null)
                        p.UnitPrice = pdto.UnitPrice.Value;
                });

            return new GetProductsOutput
            {
                Products = productDtos
            };
        }
Beispiel #2
0
 public GetProductsOutput UpdateProducts(UpdateProductsInput productsDtos)
 {
     return _productServiceImp.UpdateProducts(productsDtos);
 }