Делая так,
вы можете передавать несколько параметров столько раз, сколько захотите
Просто передайте данные как модель из вашего js как
var employee = new Object();
employee.Name = "ABC"
employee.Address = "PUNE";
employee.Location = "PUNE";
$.ajax({
type: "POST",
url: "/Home/PersistTimeOfDay",
data: JSON.stringify(employee),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(response) {
// Do your code here
},
failure: function(response) {
alert(response.responseText);
},
error: function(response) {
alert(response.responseText);
}
});
и создайте одну модель как Employee, как
public class Employee
{
public string Name {get;set;}
public string Designation {get;set;}
public string Location {get;set;}
}
и просто добавьте код в свой контроллер
[HttpPost]
public JsonResult PersistTimeOfDay(Employee employeeData) {
Employee employee = new Employee {
Name = employeeData.Name,
Designation = employeeData.Designation,
Location = employeeData.Location
};
return Json(employee, JsonRequestBehavior.AllowGet);
}