Tuesday, 15 May 2012

c# - Array not accepting zero values -



c# - Array not accepting zero values -

i create ajax post call,

$scope.clientlist = []; $http({ method: 'post', datatype: 'json', contenttype: "application/json; charset=utf-8", url: "https://localhost/api/client", data: json.stringify($scope.user) }).success(function (response, status, headers, config) { $scope.clientlist = response.data; }). error(function (data, status, headers, config) {});

now controller,

public list<customer> post([frombody] client customer) { customer.count = 0; lstcustomer.add(customer); homecoming lstcustomers; }

customer class

public class client { public string cname{ get; set; } public int count{ get; set; } }

but returned array doesnt contain count parameter newly added customer. doesnt take 0 values.

how can accomplish ?

c# javascript ajax arrays

No comments:

Post a Comment