Example #1
0
        public async Task <ActionResult <ProductImage> > AddProductImage(ProductImage productImage)
        {
            try
            {
                if (productImage == null)
                {
                    return(BadRequest());
                }
                else
                {
                    var createdProductImage = await _productImageRepository.AddProductImage(productImage);

                    return(createdProductImage);
                }
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError,
                                  "Error with posting data to the database"));
            }
        }