public async Task <Unit> Handle(UpdateProductCommandModel request, CancellationToken cancellationToken)
        {
            await productCommandService.UpdateAsync(request.Id, request.Name, request.NameEng, request.Price,
                                                    request.Description, request.DescriptionEng, request.AcceptCharms, request.Sizes);

            return(Unit.Value);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutProduct(ProductDto Product)
        {
            var result = await new ProductValidator(false).ValidateAsync(Product);

            if (!result.IsValid)
            {
                var Properties = new List <string>();
                foreach (var error in result.Errors)
                {
                    Properties.Add(error.ErrorMessage);
                }
                var Message = new { descrption = "Validation errors", Properties };
                return(BadRequest(Message));
            }
            await _productCommand.UpdateAsync(Product);

            return(Ok());
        }
Exemplo n.º 3
0
 public async Task <ProductDal> UpdateProduct([FromBody] ProductDal product)
 {
     return(await _productCommandService.UpdateAsync(product));
 }