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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Manas MohapatraPosted Nov 24, 2016, 1:06 AM
Gurmeet SinghPosted Nov 28, 2016, 1:06 AM
//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 SinghPosted Nov 28, 2016, 1:05 AM
//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;
}
}
Manas MohapatraPosted Nov 26, 2016, 6:41 AM
Gurmeet SinghPosted Nov 26, 2016, 5:51 AM