suman goud

suman goud

  • NA
  • 176
  • 50.9k

how to insert multiple table rows data in database

Sep 17 2016 6:27 AM
my controller code is correct ,values are not coming from view.if i un comment code in controller multiple values inserting
but i want to get multiple table row count from view to tba parameter
public JsonResult InsertReceipts(List<tblTowardsBillsAdjusted> tba)
{
using (TestDemoEntities dc = new TestDemoEntities())
{
//List<tblTowardsBillsAdjusted> tba = new List<tblTowardsBillsAdjusted> { new tblTowardsBillsAdjusted { DiscountAccount1="10",DiscountAmount1=10,RefNumber="ref44" },
// new tblTowardsBillsAdjusted { DiscountAccount1="100",DiscountAmount1=10,RefNumber="ref45" } };
foreach (var i in tba)
{
dc.tblTowardsBillsAdjusteds.Add(i);
}
dc.SaveChanges();
}
view
<table class="tableData" >
<tr>
<th>Customer</th>
<th>Pendings</th>
<th>Pending Value</th>
</tr>
<tr ng-repeat="r in rvm" ng-class-odd="'odd'" ng-class-even="'even'">
<td>
<select ng-model="ID" ng-options="c.ID as c.Name for c in customer" ng-change="GetAccountBalance()" name=" tCustomer">
<option value="">Select Customer</option>
</select>
<td>
<span id="spAmount" >{{ReceiptsViewModel.PendingAmount}}</span>
</td>
<td>
<input type="text" ng-value="0.00" ng-model="ReceiptsViewModel.AdjustAmount" ng-model-onblur ng-change="GetTotalAmount()" class="input-large" name="tAmount" />
</td>
</tr>
</table>
angular
$scope.rvm = [{}];
$scope.GetAccountBalance = function () {
$scope.rvm.push({
});
}
am able to insert this using mvc razor,but i want using angular and mvc
if you want i will post that code

Answers (1)