public async Task<IActionResult> DeleteProductManufacturer(string key, [FromBody] ODataActionParameters parameters) { if (parameters == null) return NotFound(); if (!await _permissionService.Authorize(PermissionSystemName.Products)) return Forbid(); var product = await _productApiService.GetById(key); if (product == null) { return NotFound(); } var manufacturerId = parameters.FirstOrDefault(x => x.Key == "ManufacturerId").Value; if (manufacturerId != null) { var pm = product.Manufacturers.Where(x => x.ManufacturerId == manufacturerId.ToString()).FirstOrDefault(); if (pm == null) ModelState.AddModelError("", "No product manufacturer mapping found with the specified id"); if (ModelState.IsValid) { await _productApiService.DeleteProductManufacturer(product, manufacturerId.ToString()); return Ok(true); } return BadRequest(ModelState); } return NotFound(); }