예제 #1
0
        public ActionResult Post(Spartan_BR_Action_ResultModel varSpartan_BR_Action_Result)
        {
            try
            {
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _ISpartan_BR_Action_ResultApiConsumer.SetAuthHeader(_tokenManager.Token);



                var result = "0";
                var Spartan_BR_Action_ResultInfo = new Spartan_BR_Action_Result
                {
                    ActionResultId = varSpartan_BR_Action_Result.ActionResultId
                    , Description  = varSpartan_BR_Action_Result.Description
                };

                result = varSpartan_BR_Action_Result.ActionResultId.ToString() != "0" ?
                         _ISpartan_BR_Action_ResultApiConsumer.Update(Spartan_BR_Action_ResultInfo, null, null).Resource.ToString() :
                         _ISpartan_BR_Action_ResultApiConsumer.Insert(Spartan_BR_Action_ResultInfo, null, null).Resource.ToString();

                if (varSpartan_BR_Action_Result.ActionResultId.ToString() != "0")
                {
                    result = varSpartan_BR_Action_Result.ActionResultId.ToString();
                }

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

            ViewBag.Permission = permission;
            var varSpartan_BR_Action_Result = new Spartan_BR_Action_ResultModel();



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

                varSpartan_BR_Action_Result = new Spartan_BR_Action_ResultModel
                {
                    ActionResultId = Spartan_BR_Action_ResultData.ActionResultId
                    , Description  = Spartan_BR_Action_ResultData.Description
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }



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