public ActionResult Post(bool IsNew, Spartan_User_RoleModel varSpartan_User_Role)
        {
            try
            {
                //if (ModelState.IsValid)
                //{
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _ISpartan_User_RoleApiConsumer.SetAuthHeader(_tokenManager.Token);



                var result = "";
                var Spartan_User_RoleInfo = new Spartane.Core.Domain.Spartan_User_Role.Spartan_User_Role
                {
                    User_Role_Id  = varSpartan_User_Role.User_Role_Id
                    , Description = varSpartan_User_Role.Description
                    , Status      = varSpartan_User_Role.Status
                };

                result = !IsNew?
                         _ISpartan_User_RoleApiConsumer.Update(Spartan_User_RoleInfo, null, null).Resource.ToString() :
                             _ISpartan_User_RoleApiConsumer.Insert(Spartan_User_RoleInfo, null, null).Resource.ToString();

                Session["KeyValueInserted"] = result;


                if (result != "-1")
                {
                    Roles.InsertUpdateObject(Convert.ToInt32(result), Spartan_User_RoleInfo.Description, "en-us");
                    Roles.InsertUpdateObject(Convert.ToInt32(result), Spartan_User_RoleInfo.Description, "es-es");
                }

                return(Json(result, JsonRequestBehavior.AllowGet));
                //}
                //return Json(false, JsonRequestBehavior.AllowGet);
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
        /// <summary>
        /// Add new user roles
        /// </summary>
        /// <remarks>
        /// Dummy Data has been passed as of now for test.
        /// Actual form will be provided by Ricardo later.
        /// </remarks>
        /// <returns></returns>
        public JsonResult AddOrUpdateUserRol(Spartane.Core.Domain.Spartan_User_Role.Spartan_User_Role role)
        {
            var successRecord = false;

            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _IUserRoleApiConsumer.SetAuthHeader(_tokenManager.Token);

            Spartane.Core.Domain.Spartan_User_Role.Spartan_User_Role userRole = new Spartane.Core.Domain.Spartan_User_Role.Spartan_User_Role()
            {
                Description = role.Description,
                Id1         = 0,
                Status      = role.Status,
                Status_Spartan_User_Role_Status = null,
                User_Role_Id = role.User_Role_Id
            };

            if (role.User_Role_Id == 0)
            {
                var roleAdded = _IUserRoleApiConsumer.Insert(role, null, null);
                if (roleAdded != null)
                {
                    successRecord     = true;
                    role.User_Role_Id = roleAdded.Resource;

                    //ADD TO TRADUCTION DETAIL TABLE
                    _ISpartan_Traduction_DetailApiConsumer.SetAuthHeader(_tokenManager.Token);
                    Spartan_Traduction_Detail traduction_detail_Spanish = new Spartan_Traduction_Detail();
                    traduction_detail_Spanish.Concept = 1;
                    traduction_detail_Spanish.Spartan_Traduction_Process = 1;
                    traduction_detail_Spanish.IdConcept       = roleAdded.Resource;
                    traduction_detail_Spanish.Original_Text   = role.Description;
                    traduction_detail_Spanish.Translated_Text = role.Description;
                    _ISpartan_Traduction_DetailApiConsumer.Insert(traduction_detail_Spanish, null, null);
                    Spartan_Traduction_Detail traduction_detail_English = new Spartan_Traduction_Detail();
                    traduction_detail_English.Concept = 1;
                    traduction_detail_English.Spartan_Traduction_Process = 3;
                    traduction_detail_English.IdConcept       = roleAdded.Resource;
                    traduction_detail_English.Original_Text   = role.Description;
                    traduction_detail_English.Translated_Text = role.Description;
                    _ISpartan_Traduction_DetailApiConsumer.Insert(traduction_detail_English, null, null);
                }
            }
            else
            {
                var roleUpdated = _IUserRoleApiConsumer.Update(role, null, null);
                if (roleUpdated != null)
                {
                    successRecord = true;
                }
            }

            if (successRecord)
            {
                Roles.InsertUpdateObject(role.User_Role_Id, role.Description, "en-us");
                Roles.InsertUpdateObject(role.User_Role_Id, role.Description, "es-es");
            }

            return(Json(successRecord ? "success" : "error", JsonRequestBehavior.AllowGet));
        }