Exemplo n.º 1
0
        public async Task <IActionResult> CreateOption(Guid productId, ProductOption option)
        {
            try
            {
                await _productService.GetProductAsync(productId);

                var id = await _productOptionService.SaveAsync(productId, option);

                return(Created(string.Empty, id));
            }
            catch (RecordNotFoundException e)
            {
                Log.Error(e, ExceptionTemplates.RecordNotFoundError);
                return(NotFound(e.Message));
            }
            catch (Exception e)
            {
                Log.Error(e, ExceptionTemplates.UnknownError);
                return(StatusCode(500));
            }
        }