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); }
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()); }
public async Task <ProductDal> UpdateProduct([FromBody] ProductDal product) { return(await _productCommandService.UpdateAsync(product)); }