public ActionResult Post(Spartan_BR_Process_EventModel varSpartan_BR_Process_Event)
        {
            try
            {
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _ISpartan_BR_Process_EventApiConsumer.SetAuthHeader(_tokenManager.Token);



                var result = "0";
                var Spartan_BR_Process_EventInfo = new Spartan_BR_Process_Event
                {
                    ProcessEventId = varSpartan_BR_Process_Event.ProcessEventId
                    , Description  = varSpartan_BR_Process_Event.Description
                };

                result = varSpartan_BR_Process_Event.ProcessEventId.ToString() != "0" ?
                         _ISpartan_BR_Process_EventApiConsumer.Update(Spartan_BR_Process_EventInfo, null, null).Resource.ToString() :
                         _ISpartan_BR_Process_EventApiConsumer.Insert(Spartan_BR_Process_EventInfo, null, null).Resource.ToString();

                if (varSpartan_BR_Process_Event.ProcessEventId.ToString() != "0")
                {
                    result = varSpartan_BR_Process_Event.ProcessEventId.ToString();
                }

                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
        public ActionResult Create(short Id = 0, int consult = 0)
        {
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 148);

            ViewBag.Permission = permission;
            var varSpartan_BR_Process_Event = new Spartan_BR_Process_EventModel();



            if (Convert.ToString(Id) != "0" && Convert.ToString(Id) != "-1")
            {
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _ISpartan_BR_Process_EventApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Spartan_BR_Process_EventData = _ISpartan_BR_Process_EventApiConsumer.GetByKeyComplete(Id).Resource.Spartan_BR_Process_Events[0];
                if (Spartan_BR_Process_EventData == null)
                {
                    return(HttpNotFound());
                }

                varSpartan_BR_Process_Event = new Spartan_BR_Process_EventModel
                {
                    ProcessEventId = Spartan_BR_Process_EventData.ProcessEventId
                    , Description  = Spartan_BR_Process_EventData.Description
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }



            ViewBag.Consult = consult == 1;
            return(View(varSpartan_BR_Process_Event));
        }