I want to save the angularjs table list in database table in mvc...
the data is coming in angularjs table from database, i want to save that data into sql table in mvc. please anyone help me...Thanx in Advance:)
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Manas MohapatraRank #182 · 13.2K reputationPosted Nov 23, 2016, 8:06 PM EST
Manas MohapatraRank #182 · 13.2K reputationPosted Nov 26, 2016, 1:41 AM EST
Gurmeet Singh158 reputationPosted Nov 26, 2016, 12:51 AM EST
Gurmeet Singh158 reputationPosted Nov 27, 2016, 8:05 PM EST
//alert(angular.toJson($scope.itemslst));
var jdata = JSON.stringify($scope.itemslst);
alert(jdata);
$.ajax({
type: "POST",
url:"/CustomerItem/GetBill",
data: { 'data': JSON.stringify(jdata) },
contentType:'application/json',
datatype:"json",
success:function (data) {
alert("success");
},
error:function (data) {
alert("error");
}
});
}
public ActionResult GetBill(List
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Mvc;
namespace CustomerBillApp.Models
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class MultipleButtonAttribute : ActionNameSelectorAttribute
{
public string Name { get; set; }
public string Argument { get; set; }
public override bool IsValidName(ControllerContext controllerContext, string actionName, MethodInfo methodInfo)
{
var isValidName = false;
var keyValue = string.Format("{0}:{1}", Name, Argument);
var value = controllerContext.Controller.ValueProvider.GetValue(keyValue);
if (value != null)
{
controllerContext.Controller.ControllerContext.RouteData.Values[Name] = Argument;
isValidName = true;
}
return isValidName;
}
}
Gurmeet Singh158 reputationPosted Nov 27, 2016, 8:06 PM EST
//alert(angular.toJson($scope.itemslst));
var jdata = JSON.stringify($scope.itemslst);
alert(jdata);
$.ajax({
type: "POST",
url:"/CustomerItem/GetBill",
data: { 'data': JSON.stringify(jdata) },
contentType:'application/json',
datatype:"json",
success:function (data) {
alert("success");
},
error:function (data) {
alert("error");
}
});
}
public ActionResult GetBill(List
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Mvc;
namespace CustomerBillApp.Models
{
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class MultipleButtonAttribute : ActionNameSelectorAttribute
{
public string Name { get; set; }
public string Argument { get; set; }
public override bool IsValidName(ControllerContext controllerContext, string actionName, MethodInfo methodInfo)
{
var isValidName = false;
var keyValue = string.Format("{0}:{1}", Name, Argument);
var value = controllerContext.Controller.ValueProvider.GetValue(keyValue);
if (value != null)
{
controllerContext.Controller.ControllerContext.RouteData.Values[Name] = Argument;
isValidName = true;
}
return isValidName;
}
}