Guest User

Untitled

a guest
Nov 13th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. public class ActionPermission2
  2. {
  3. public int ID = 0;
  4. public int FKMenuID = 0;
  5. public string ActionName = "";
  6. public string Allowed = "";
  7. public int PermissionType = 0;
  8. public int PermissionTypeID = 0;
  9. }
  10.  
  11. public ActionResult UpdateModel2(List<ActionPermission2> menuPermissionsModel)
  12. {
  13. return Json(true, JsonRequestBehavior.AllowGet);
  14. }
  15.  
  16. public ActionResult UpdateModelSA(string[] menuPermissionsModel)
  17. {
  18. return Json(true, JsonRequestBehavior.AllowGet);
  19. }
  20.  
  21. $('input[type=checkbox]').each(function ()
  22. {
  23. var datarow = {
  24. "ID": pId,
  25. "FKMenuID": mId,
  26. "ActionName": actionName,
  27. "Allowed": checked,
  28. "PermissionType": "",
  29. "PermissionTypeID": ptId
  30. };
  31.  
  32. jsonObj.push(datarow);
  33. }
  34. });
  35. $.ajax({
  36. type: "POST",
  37.  
  38. //url: "@Url.Action("Update")", //string[] menuPermissionsModel
  39. url: "@Url.Action("UpdateModel2")", //List<ActionPermission2> menuPermissionsModel
  40. //url: "@Url.Action("UpdateModelSA2")", //List<string> menuPermissionsModel
  41.  
  42. data: JSON.stringify({ 'menuPermissionsModel': jArray }),
  43.  
  44. traditional: true,
  45. contentType: "application/json; charset=utf-8",
  46. dataType: "json",
  47. success: function (data)
  48. {
  49. alert('data: ' + data);
  50. },
  51. error: function (data)
  52. {
  53. alert("error");
  54. console.log(data);
  55. }
  56. });
Add Comment
Please, Sign In to add comment