public async Task<IActionResult> UpdateProductPicture(string key, [FromBody] ProductPictureDto productPicture) { if (productPicture == null) return NotFound(); if (!await _permissionService.Authorize(PermissionSystemName.Products)) return Forbid(); var product = await _productApiService.GetById(key); if (product == null) { return NotFound(); } var pp = product.Pictures.Where(x => x.PictureId == productPicture.PictureId).FirstOrDefault(); if (pp == null) ModelState.AddModelError("", "No product picture mapping found with the specified id"); if (ModelState.IsValid) { await _productApiService.UpdateProductPicture(product, productPicture); return Ok(true); } return BadRequest(ModelState); }