public async Task <IActionResult> Post(ProductCreateModel model)
        {
            var createdProduct = await _productService.CreateAsync(model);

            var response  = new Response(createdProduct);
            var getParams = new { createdProduct.Id };

            return(CreatedAtAction(nameof(Get), getParams, response));
        }
        public async Task <IActionResult> Create(string lawnId, ProductApplicationForCreate newProductApplication)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var application = await _productApplicationService.CreateAsync(lawnId, newProductApplication);

            return(CreatedAtAction(nameof(Get), new { productApplicationId = application.Id }, new ProductApplication(application)));
        }
Esempio n. 3
0
 public async Task <ProductGetResponseModel> Post([FromBody] ProductCreateOrUpdateRequestModel value)
 {
     return(await _productService.CreateAsync(value));
 }