Ejemplo n.º 1
0
        public async Task <IActionResult> AddProductOptionsAsync(string productId, [FromBody] List <ProductOption> options)
        {
            try
            {
                var result = await _productOptionService.AddManyProductOptionsAsync(productId, options);

                return(Ok(result));
            }
            catch (ProductNotFoundException pne)
            {
                _logger.LogError($"An error occurred. Exception: {pne}");
                return(NotFound($"Product {productId} not found"));
            }
            catch (Exception ex)
            {
                _logger.LogError($"An error occurred. Exception: {ex}");
                return(StatusCode(500, "Internal Server Error. Please try again later"));
            }
        }