public async Task<IActionResult> CreateProductTierPrice(string key, [FromBody] ProductTierPriceDto productTierPrice) { if (productTierPrice == null) return NotFound(); if (!await _permissionService.Authorize(PermissionSystemName.Products)) return Forbid(); var product = await _productApiService.GetById(key); if (product == null) { return NotFound(); } var pt = product.TierPrices.Where(x => x.Id == productTierPrice.Id).FirstOrDefault(); if (pt != null) ModelState.AddModelError("", "Product tier price mapping found with the specified id"); if (ModelState.IsValid) { await _productApiService.InsertProductTierPrice(product, productTierPrice); return Ok(true); } return BadRequest(ModelState); }