public ActionResult Delete(int id) { try { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_Format_PermissionsApiConsumer.SetAuthHeader(_tokenManager.Token); //Spartan_Format_Permissions varSpartan_Format_Permissions = null; if (id.ToString() != "0") { } var result = _ISpartan_Format_PermissionsApiConsumer.Delete(id, null, null).Resource; return(Json(result, JsonRequestBehavior.AllowGet)); } catch (ServiceException) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public JsonResult processPermissions(List <Spartan_Format_Permissions> list) { string respuesta = ""; bool token = _tokenManager.GenerateToken(); if (!token) { return(Json(null, JsonRequestBehavior.AllowGet)); } else { _ISpartan_Format_PermissionsApiConsumer.SetAuthHeader(_tokenManager.Token); foreach (Spartan_Format_Permissions s in list) { if (s.Apply == true) { if (s.PermissionId > 0) { respuesta = JsonConvert.SerializeObject(_ISpartan_Format_PermissionsApiConsumer.Update(s, null, null)); } else { respuesta = JsonConvert.SerializeObject(_ISpartan_Format_PermissionsApiConsumer.Insert(s, null, null)); } } else { respuesta = JsonConvert.SerializeObject(_ISpartan_Format_PermissionsApiConsumer.Delete(s.PermissionId, null, null)); } //return Json(_ISpartan_Format_PermissionsApiConsumer.Insert(s, null, null), JsonRequestBehavior.AllowGet); } return(Json(true, JsonRequestBehavior.AllowGet)); } }