Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
847
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @section scripts {
  2.     <script>
  3.         $(document).ready(function () {
  4.             AddTaskToUser = function () {
  5.                 @*$.get('@Url.Action("GetAddTask", "Users", new {userId = Model.User.Id})', )*@
  6.                 $.get('@(Url.Action("GetAddTask", "Users", new {userId = Model.User.Id}))',
  7.                     function (taskAssignPartialHtml) {
  8.                         bootbox.dialog({
  9.                             title: "Assign a Task",
  10.                             message: taskAssignPartialHtml,
  11.                             buttons: {
  12.                                 cancel: {
  13.                                     label: "Cancel",
  14.                                     className: "btn-cancel",
  15.                                     callback: function () { }
  16.                                 },
  17.                                 success: {
  18.                                     label: "Add",
  19.                                     className: "btn-success",
  20.                                     callback: function () {
  21.                                         $.ajax({
  22.                                             type: "POST",
  23.                                             url: '@Url.Action("AssignTaskFromPartial", "Users")',
  24.                                             data: $('#taskForm').serialize(),
  25.                                             success: function (result) {
  26.                                                 if (result) {
  27.                                                     if (result.result == true) {
  28.                                                         alert("hello");
  29.                                                         $("#userTasksDiv").load('@(Url.Action("GetUserTasks", "Users", new { userId = Model.User.Id }))', function () {
  30.                                                             //FormatRewardsTable();
  31.                                                         });
  32.                                                     }
  33.                                                     else {
  34.                                                         bootbox.dialog({
  35.                                                             title: "Error loading rewards",
  36.                                                             message: result.message,
  37.                                                             buttons: {
  38.                                                                 cancel: {
  39.                                                                     label: "OK",
  40.                                                                     className: "btn-primary",
  41.                                                                     callback: function () {
  42.  
  43.                                                                     }
  44.                                                                 }
  45.                                                             }
  46.                                                         });
  47.                                                     }
  48.                                                 }
  49.  
  50.                                             },
  51.                                             error: function (err) {
  52.                                                 alert("Ajax save error. " + err);
  53.                                             }
  54.                                         });
  55.  
  56.                                     }
  57.                                 }
  58.                             }
  59.                         });
  60.                     });
  61.             }
  62.  
  63.             AddCertToUser = function () {
  64.                 @*$.get('@Url.Action("GetAddTask", "Users", new {userId = Model.User.Id})', )*@
  65.                 $.get('@(Url.Action("GetAddCert", "Users", new {userId = Model.User.Id}))',
  66.                     function (certAssignPartialHtml) {
  67.                         bootbox.dialog({
  68.                             title: "Assign a Certification",
  69.                             message: certAssignPartialHtml,
  70.                             buttons: {
  71.                                 cancel: {
  72.                                     label: "Cancel",
  73.                                     className: "btn-cancel",
  74.                                     callback: function () { }
  75.                                 },
  76.                                 success: {
  77.                                     label: "Add",
  78.                                     className: "btn-success",
  79.                                     callback: function () {
  80.                                         $.ajax({
  81.                                             type: "POST",
  82.                                             url: '@Url.Action("AssignCertFromPartial", "Users")',
  83.                                             data: $('#certForm').serialize(),
  84.                                             success: function (result) {
  85.                                                 if (result) {
  86.                                                     if (result.result == true) {
  87.                                                         alert("hello");
  88.                                                         $("#userCertsDiv").load('@(Url.Action("GetUserCerts", "Users", new { userId = Model.User.Id }))', function () {
  89.                                                             //FormatRewardsTable();
  90.                                                         });
  91.                                                     }
  92.                                                     else {
  93.                                                         bootbox.dialog({
  94.                                                             title: "Error loading rewards",
  95.                                                             message: result.message,
  96.                                                             buttons: {
  97.                                                                 cancel: {
  98.                                                                     label: "OK",
  99.                                                                     className: "btn-primary",
  100.                                                                     callback: function () {
  101.  
  102.                                                                     }
  103.                                                                 }
  104.                                                             }
  105.                                                         });
  106.                                                     }
  107.                                                 }
  108.  
  109.                                             },
  110.                                             error: function (err) {
  111.                                                 alert("Ajax save error. " + err);
  112.                                             }
  113.                                         });
  114.  
  115.                                     }
  116.                                 }
  117.                             }
  118.                         });
  119.                     });
  120.             }
  121.         });
  122.     </script>
  123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement