public async Task <ActionResult> GetProductOptions(Guid productId) { try { var products = await _productOptionService.GetAllAsync(productId); return(Ok(products)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> GetAllProductOptions() { try { _logger.LogDebug($"Received {nameof(GetAllProductOptions)} request"); var productOptions = await _service.GetAllAsync(); _logger.LogDebug($"Returned {productOptions.Count()} products as part of {nameof(GetAllProductOptions)} request"); return(Ok(_mapper.Map <IEnumerable <ProductOptionResponseDto> >(productOptions))); } catch (EntityNotFoundException exception) { _logger.LogError(exception, exception.Message); return(NotFound(exception.Message)); } }