public async Task <ActionResult> Post(product_value productValue)
        {
            if (ModelState.IsValid)
            {
                string proplem = ConstraintsTest(productValue).Result;
                if (proplem == "")
                {
                    var result = await dbContext.fdc_products_values.AddAsync(productValue);

                    if (result != null && result.State == EntityState.Added)
                    {
                        try
                        {
                            await dbContext.SaveChangesAsync();

                            var response = await dbContext.GetProductValue(result.Entity.product_value_id);

                            return(Ok(response));
                        }
                        catch
                        { }
                    }
                    return(NotFound($"{result.State}"));
                }
                else
                {
                    return(NotFound($"{proplem}"));
                }
            }
            return(BadRequest());
        }
        public async Task <ActionResult> Put(int id, product_value productValue)
        {
            if (ModelState.IsValid)
            {
                productValue.product_property_id = id;
                string proplem = ConstraintsTest(productValue).Result;
                if (proplem == "")
                {
                    var result = dbContext.fdc_products_values.Update(productValue);

                    if (result != null && result.State == EntityState.Modified)
                    {
                        await dbContext.SaveChangesAsync();

                        var response = await dbContext.GetProductValue(result.Entity.product_property_id);

                        return(Ok(response));
                    }
                    return(NotFound("Свойства продукта не найден"));
                }
                else
                {
                    return(NotFound($"{proplem}"));
                }
            }
            return(BadRequest());
        }
        /// <summary>
        /// Проверка на существования связанных сущностей в БД
        /// </summary>
        private async Task <string> ConstraintsTest(product_value productValue)
        {
            var product_type = await dbContext.GetProduct(productValue.product_property_id);

            var product = await dbContext.GetProduct(productValue.product_id);

            string proplem = string.Format("{0}{1}"
                                           , product == null ? "Не указан продукт. " : ""
                                           , product_type == null ? "Не указан тип продукта. " : "");

            return(proplem);
        }