public async Task<IActionResult> CreateProductManufacturer(string key, [FromBody] ProductManufacturerDto productManufacturer) { if (productManufacturer == null) return NotFound(); if (!await _permissionService.Authorize(PermissionSystemName.Products)) return Forbid(); var product = await _productApiService.GetById(key); if (product == null) { return NotFound(); } var pm = product.Manufacturers.Where(x => x.ManufacturerId == productManufacturer.ManufacturerId).FirstOrDefault(); if (pm != null) ModelState.AddModelError("", "Product manufacturer mapping found with the specified manufacturerid"); if (ModelState.IsValid) { await _productApiService.InsertProductManufacturer(product, productManufacturer); return Ok(true); } return BadRequest(ModelState); }