コード例 #1
0
        public IHttpActionResult Delete(Guid id, Guid optionId)
        {
            try
            {
                if (!_productOptionRepository.ProductOptionExists(optionId))
                {
                    return(NotFound());
                }

                var productOption = _productOptionRepository.GetProductOptionForProduct(id, optionId);

                if (productOption == null)
                {
                    return(NotFound());
                }

                _productOptionRepository.DeleteProductOption(optionId, id);

                if (!_productOptionRepository.Save())
                {
                    return(InternalServerError());
                }
                return(new ResponseMessageResult(new HttpResponseMessage(HttpStatusCode.NoContent)));
            }
            catch (Exception ex)
            {
                return(new ResponseMessageResult(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message)));
            }
        }
コード例 #2
0
 public void DeleteProductOption(Guid id)
 {
     _productOptionRepository.DeleteProductOption(id);
 }