Пример #1
0
        public async Task <IActionResult> GetOption(Guid productId, Guid id)
        {
            try
            {
                await _productService.GetProductAsync(productId);

                var productOption = await _productOptionService.GetProductOptionAsync(id);

                return(Ok(productOption));
            }
            catch (RecordNotFoundException e)
            {
                Log.Error(e, ExceptionTemplates.RecordNotFoundError);
                return(NotFound(e.Message));
            }
            catch (Exception e)
            {
                Log.Error(e, ExceptionTemplates.UnknownError);
                return(StatusCode(500));
            }
        }
Пример #2
0
        public async Task <ActionResult> GetProductOptions(Guid productId, Guid productOptionId)
        {
            try
            {
                var productOptionDto = await _productOptionService.GetProductOptionAsync(productId, productOptionId);

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