private void btnSave_Click(object sender, EventArgs e) { var model = new BillOFMaterialModel() { BillOfmaterialCode = txtMaterialCode.Text, ProductId = (int)CmbProduct.SelectedValue, BatchQuantity = Convert.ToInt32(txtbatchquantity.Text), CartoonQuantity = Convert.ToInt32(txtCartoonquantity.Text), }; int BillId = _billOfMaterial.SaveBillofMaterial(model); var griddata = datafnuc(); _billOfMaterial.SaveBillofMaterialDetail(griddata, BillId); }