public async Task <IActionResult> AddProductOption(ProductOptionCreateRequestDto productOptionCreateRequest)
        {
            _logger.LogDebug($"Received {nameof(AddProductOption)} request with {{@ProductOptionCreateRequest}}", productOptionCreateRequest);
            var productOptionId = await _service.AddAsync(_mapper.Map <ProductOption>(productOptionCreateRequest));

            _logger.LogDebug($"Returned {nameof(AddProductOption)} request with Id {productOptionId}");
            return(CreatedAtAction(nameof(AddProductOption), productOptionId, productOptionId));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Add(ProductOptionDto productOptionDto)
        {
            try
            {
                await _productOptionService.AddAsync(productOptionDto);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }