Пример #1
0
        public async Task <IActionResult> AddProperty([FromBody] AddPropertyToProductDto model)
        {
            var addPropertyRes = await _productService.AddNewPropertyAsync(model.SubCategory, model.PropName);

            if (!addPropertyRes)
            {
                return(BadRequest("Can't add new property"));
            }

            var addPossiblePropsRes =
                await _productService.AddNewPossiblePropertiesAsync(model.SubCategory, model.PropName,
                                                                    model.PropValues);

            if (!addPossiblePropsRes)
            {
                return(BadRequest("Cant add possible property"));
            }

            return(Ok("Success"));
        }