public async Task <IActionResult> Create([FromBody] ProductModel product) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } await _createProductUseCase.Handle( new CreateProductRequest(product.Name, product.Description, product.Price, product.Category), _createProductPresenter); return(_createProductPresenter.JsonResult); }
public async Task <ActionResult <ProductResponse> > HandleAsncy(ProductRequest request) { var product = await useCase.Handle(request.ToProduct()); return(ProductResponse.FromProduct(product)); }