Dear sir,
I have a mvc inventory management project so I need to insert multiple rows values in to multiple tables using code first approach. I have not get enough snippets from internet kindly help me. I also make the code but I think it is a complicated way or code.
using ASPMVC.Models
@model IEnumerable<BsaModel>
@{
ViewBag.Title = "BSA";
}
<h2>Sales</h2>
@using (Html.BeginForm("Insert", "Test",FormMethod.Post))
{
@Html.AntiForgeryToken()
<div class="bggrdnt">
<div style="overflow:auto">
<table id="tblItems" class="table table-responsive" style="background-color:whitesmoke">
<thead>
<tr>
<th>Items</th>
<th>HSN Code</th>
<th>Rate</th>
<th>Sgst</th>
<th>Cgst</th>
<th>Qty</th>
<th>Dis</th>
<th>Dis Amt</th>
<th>Cgst Amt</th>
<th>Sgst Amt</th>
<th>Amount</th>
<th>Total</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach(BsaModel products in Model)
{
<tr>
<td>@products.billing</td>
<td>@products.Hsncode</td>
<td>@products.Rate</td>
<td>@products.Sgst</td>
<td>@products.Cgst</td>
<td>@products.Discounts</td>
<td>@products.Disamt</td>
<td>@products.Sgstamt</td>
<td>@products.Cgstamt</td>
<td>@products.Amount</td>
<td>@products.Total</td>
<td><input type="button" value="Remove" onclick="Remove(this)" /></td>
</tr>
}
</tbody>
<tfoot>
<tr>
<td>@Html.DropDownListFor(m => m.id, Model.<span style=""color:" #ff0000;"="">billing</span>, "Please select", new { @id = "ddlItems", @class = "form-control" })</td>
<td>@Html.TextBoxFor(m => m.<span style=""color:" #ff0000;"="">Hsncode</span>, new { @id = "txthsncode", @class = "form-control" })</td>
<td>@Html.TextBoxFor(m => m.<span style=""color:" #ff0000;"="">Rate</span>, new { @id = "txtRate", @class = "form-control" })</td>
<td>@Html.TextBoxFor(m => m.<span style=""color:" #ff0000;"="">Sgst</span>, new { @id = "txtSgst", @class = "form-control", onmouseenter = "Sgstpar();" })</td>
<td>@Html.TextBoxFor(m => m.<span style=""color:" #ff0000;"="">Cgst</span>, new { @id = "txtCgst", @class = "form-control", onmouseenter = "Cgstpar();" })</td>
<td>@Html.TextBoxFor(m => m.<span style=""color:" #ff0000;"="">Quantity</span>, new { @id = "txtqty", @class = "form-control" })</td>
<td>@Html.TextBoxFor(m => m.<span style=""color:" #ff0000;"="">Discounts</span>, new { @id = "txtdisc", @class = "form-control" })</td>
<td>@Html.TextBoxFor(m => m.<span style=""color:" #ff0000;"="">Disamt</span>, new { @id = "txtdisamt", @class = "form-control" })</td>
<td>@Html.TextBoxFor(m => m.<span style=""color:" #ff0000;"="">Sgstamt</span>, new { @id = "txtSgstamt", @class = "form-control", onmouseenter = "Sgstpar();" })</td>
<td>@Html.TextBoxFor(m => m.<span style=""color:" #ff0000;"="">Cgstamt</span>, new { @id = "txtCgstamt", @class = "form-control", onmouseenter = "Cgstpar();" })</td>
<td>@Html.TextBoxFor(m => m.<span style=""color:" #ff0000;"="">Amount</span>, new { @id = "txtamt", @class = "form-control", onmouseenter = "Calculate();" })</td>
<td>@Html.TextBoxFor(m => m.<span style=""color:" #ff0000;"="">Total</span>, new { @id = "txttotal", @class = "form-control" })</td>
<td><input type="button" id="" onclick="Add()" value="Add" /></td>
</tr>
</tfoot>
</table>
</div>
</div>