public async Task<IActionResult> UpdateStock(string key, [FromBody] ODataActionParameters parameters) { if (!await _permissionService.Authorize(PermissionSystemName.Products)) return Forbid(); var product = await _productApiService.GetById(key); if (product == null) { return NotFound(); } if (parameters == null) return NotFound(); var warehouseId = parameters.FirstOrDefault(x => x.Key == "WarehouseId").Value; var stock = parameters.FirstOrDefault(x => x.Key == "Stock").Value; if (stock != null) { if (int.TryParse(stock.ToString(), out int stockqty)) { await _productApiService.UpdateStock(product, warehouseId?.ToString(), stockqty); return Ok(true); } } return Ok(false); }