public ActionResult Post(Spartan_BR_Presentation_Control_TypeModel varSpartan_BR_Presentation_Control_Type) { try { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_BR_Presentation_Control_TypeApiConsumer.SetAuthHeader(_tokenManager.Token); var result = "0"; var Spartan_BR_Presentation_Control_TypeInfo = new Spartan_BR_Presentation_Control_Type { PresentationControlTypeId = varSpartan_BR_Presentation_Control_Type.PresentationControlTypeId , Description = varSpartan_BR_Presentation_Control_Type.Description }; result = varSpartan_BR_Presentation_Control_Type.PresentationControlTypeId.ToString() != "0" ? _ISpartan_BR_Presentation_Control_TypeApiConsumer.Update(Spartan_BR_Presentation_Control_TypeInfo, null, null).Resource.ToString() : _ISpartan_BR_Presentation_Control_TypeApiConsumer.Insert(Spartan_BR_Presentation_Control_TypeInfo, null, null).Resource.ToString(); if (varSpartan_BR_Presentation_Control_Type.PresentationControlTypeId.ToString() != "0") { result = varSpartan_BR_Presentation_Control_Type.PresentationControlTypeId.ToString(); } return(Json(result, JsonRequestBehavior.AllowGet)); } catch (ServiceException) { return(Json(false, JsonRequestBehavior.AllowGet)); } }
public ActionResult Create(int Id = 0, int consult = 0) { var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 147); ViewBag.Permission = permission; var varSpartan_BR_Presentation_Control_Type = new Spartan_BR_Presentation_Control_TypeModel(); if (Convert.ToString(Id) != "0" && Convert.ToString(Id) != "-1") { if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } _ISpartan_BR_Presentation_Control_TypeApiConsumer.SetAuthHeader(_tokenManager.Token); var Spartan_BR_Presentation_Control_TypeData = _ISpartan_BR_Presentation_Control_TypeApiConsumer.GetByKeyComplete(Id).Resource.Spartan_BR_Presentation_Control_Types[0]; if (Spartan_BR_Presentation_Control_TypeData == null) { return(HttpNotFound()); } varSpartan_BR_Presentation_Control_Type = new Spartan_BR_Presentation_Control_TypeModel { PresentationControlTypeId = Spartan_BR_Presentation_Control_TypeData.PresentationControlTypeId , Description = Spartan_BR_Presentation_Control_TypeData.Description }; } if (!_tokenManager.GenerateToken()) { return(Json(null, JsonRequestBehavior.AllowGet)); } ViewBag.Consult = consult == 1; return(View(varSpartan_BR_Presentation_Control_Type)); }