Exemplo n.º 1
0
        public IList <ProductOptionDTO> GetProductOptions(Guid productId)
        {
            IList <ProductOptionDTO> productOptionDTO = _productOptionService.GetProductOptions(productId);

            if (productOptionDTO.Count == 0 || productOptionDTO == null)
            {
                var response = new HttpResponseMessage(HttpStatusCode.NotFound)
                {
                    Content      = new StringContent(string.Format("No Product Options Found with ProductID={0}", productId)),
                    ReasonPhrase = "No Product Options Found"
                };
                throw new HttpResponseException(response);
            }
            return(productOptionDTO);
        }
Exemplo n.º 2
0
 public async Task <ActionResult <IEnumerable <ViewProductOption> > > GetProductOptions(Guid id)
 {
     try
     {
         return(Ok(await _productOptionsService.GetProductOptions(id)));
     }
     catch (Exception ex)
     {
         _logger.LogError(ex.Message);
         return(StatusCode(500, new ApiResponse {
             Result = 1, Message = ex.Message
         }));
     }
 }