protected void btnSave_Click(object sender, EventArgs e) { Items itemsModel = new Items(); Stock stock = new Stock(); UOM uOM = new UOM(); //Inserting an Items itemsModel.Item_Description = txt_Itemdesc.Text; itemsModel.Uom_Id = Convert.ToInt32(ddluom.SelectedItem.Value); itemsModel.Quantity = Convert.ToInt32(txtQuantity.Text); int ItemID = item.CreateItem(itemsModel); //Getting UOM Data for conversion item quantity uOM = uomsService.GetUOM(itemsModel.Uom_Id); stock.Location_Id = Convert.ToInt32(ddlLocations.SelectedItem.Value); stock.Item_Id = ItemID; stock.Base_Uom_Id = uOM.Id; stock.Stock_Quantity = itemsModel.Quantity * uOM.unit_factor; int result = stockService.CreateStock(stock); if (result > 0) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Success", "alert('Item Added Successfully');", true); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Success", "alert('Something went wrong');", true); } dataTable.Rows.Clear(); LoadGridTable(); }
public void CreateStock([FromBody] GoodsMovements GoodsMovements) { _repository.CreateStock(GoodsMovements); }