Kendo UI 删除网格中的事件显示错误 "Failed to load resource: the server responded with a status of 400 ()"

Kendo UI remove events in grid is showing error "Failed to load resource: the server responded with a status of 400 ()"

** 使用 Angular 删除 kendo UI 网格数据时出现生产错误:“加载资源失败:服务器响应状态为 400 ()”。它在开发环境中运行良好。 **

组件

public removeHandler({ dataItem }): void {
    console.log('Current Url before calling api is : ' + this.partsApiUrl + 'DeleteSku/' + dataItem.dcSkuId)
    this.partsService.removeParts(this.partsApiUrl + 'DeleteSku/' + dataItem.dcSkuId)
      .subscribe(
        (item: any) => {
          console.log('result is :' + item.resultDetail);
          // refresh the list
          this.printergriddata = this.printergriddata.filter(x => x.dcSkuId != dataItem.dcSkuId);
        },
        error => {
          
        });
  }

Angular 服务

removeParts(apiUrl): Observable<any> {
    console.log(apiUrl);
    return this._http.delete(apiUrl);
  }

控制器

[HttpDelete]
        [Route("DeleteSku/{skuid}")]
        public IActionResult DeleteSku(int skuid)
        {
            try
            {
                var results = _db.DeleteParts(skuid);
                return Ok(results);
            }
            catch (Exception ex)
            {
                return BadRequest(ex.Message);
            }
        }

public static GenericResponse DeleteParts(int id)
        {
            GenericResponse resp = new GenericResponse();

            if (id < 0)
            {
                resp.ResultMessage = "Invalid request";
                resp.ResultDetail = "Sku id is less then 0.";                
                return resp;
            }

            using (var ctx = new _dc())
            {
                var data = ctx.Sku
                    .Where(s => s.Id == id)
                    .FirstOrDefault();

                if (data != null)
                {
                    ctx.Entry(data).State = EntityState.Deleted;
                    ctx.SaveChanges();
                }
                else
                {
                    resp.ResultMessage = "Requested grid data not found.";
                    resp.ResultDetail = $"Skuid {id} is not available.";                   
                    return resp;
                }
            }
            
            resp.ResultMessage = "Success";
            resp.ResultDetail = $"Data deleted: {id}.";
            return resp;
        }

Added image for error(getting this issue in production environment)

感谢提前

using (var ctx = new _dc()) // problem here I found. I was initializing context class twice one in controller and one in class.
            {
                var data = ctx.Sku
                    .Where(s => s.Id == id)
                    .FirstOrDefault();

                if (data != null)
                {
                    ctx.Entry(data).State = EntityState.Deleted;
                    ctx.SaveChanges();
                }
                else
                {
                    resp.ResultMessage = "Requested grid data not found.";
                    resp.ResultDetail = $"Skuid {id} is not available.";                   
                    return resp;
                }
            }