/// <summary>
        /// Used to get the user Status
        /// </summary>
        /// <returns></returns>
        public JsonResult GetUserRoleStatus()
        {
            if (!_tokenManager.GenerateToken())
            {
                return(null);
            }
            _IUserRoleStatusApiConsumer.SetAuthHeader(_tokenManager.Token);

            var result = _IUserRoleStatusApiConsumer.GetAll(false).Resource;

            return(Json(result == null ? null : result.Select(m => new { Text = m.Description, Value = m.User_Role_Status_Id }), JsonRequestBehavior.AllowGet));
        }
        public ActionResult Create(int Id = 0, int consult = 0)
        {
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 103);

            ViewBag.Permission = permission;
            var varSpartan_User_Role_Status = new Spartan_User_Role_StatusModel();

            ViewBag.ObjectId  = "103";
            ViewBag.Operation = "New";

            ViewBag.IsNew = true;



            if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0"))
            {
                ViewBag.IsNew     = false;
                ViewBag.Operation = "Update";
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _ISpartan_User_Role_StatusApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Spartan_User_Role_StatusData = _ISpartan_User_Role_StatusApiConsumer.GetByKeyComplete(Id).Resource.Spartan_User_Role_Statuss[0];
                if (Spartan_User_Role_StatusData == null)
                {
                    return(HttpNotFound());
                }

                varSpartan_User_Role_Status = new Spartan_User_Role_StatusModel
                {
                    User_Role_Status_Id = (int)Spartan_User_Role_StatusData.User_Role_Status_Id
                    , Description       = Spartan_User_Role_StatusData.Description
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }



            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varSpartan_User_Role_Status));
        }
        public ActionResult Create(int Id = 0, int consult = 0)
        {
            var permission = PermissionHelper.GetRoleObjectPermission(SessionHelper.Role, 101);

            ViewBag.Permission = permission;
            var varSpartan_User_Role = new Spartan_User_RoleModel();

            ViewBag.ObjectId  = "101";
            ViewBag.Operation = "New";

            ViewBag.IsNew = true;



            if ((Id.GetType() == typeof(string) && Id.ToString() != "") || ((Id.GetType() == typeof(int) || Id.GetType() == typeof(Int16) || Id.GetType() == typeof(Int32) || Id.GetType() == typeof(Int64) || Id.GetType() == typeof(short)) && Id.ToString() != "0"))
            {
                ViewBag.IsNew     = false;
                ViewBag.Operation = "Update";
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _ISpartan_User_RoleApiConsumer.SetAuthHeader(_tokenManager.Token);
                var Spartan_User_RoleData = _ISpartan_User_RoleApiConsumer.GetByKeyComplete(Id).Resource.Spartan_User_Roles[0];
                if (Spartan_User_RoleData == null)
                {
                    return(HttpNotFound());
                }

                varSpartan_User_Role = new Spartan_User_RoleModel
                {
                    User_Role_Id        = (int)Spartan_User_RoleData.User_Role_Id
                    , Description       = Spartan_User_RoleData.Description
                    , Status            = Spartan_User_RoleData.Status
                    , StatusDescription = (string)Spartan_User_RoleData.Status_Spartan_User_Role_Status.Description
                };
            }
            if (!_tokenManager.GenerateToken())
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }

            _ISpartan_User_Role_StatusApiConsumer.SetAuthHeader(_tokenManager.Token);
            var Spartan_User_Role_Statuss = _ISpartan_User_Role_StatusApiConsumer.SelAll(true);

            if (Spartan_User_Role_Statuss != null && Spartan_User_Role_Statuss.Resource != null)
            {
                ViewBag.Spartan_User_Role_Statuss = Spartan_User_Role_Statuss.Resource.Select(m => new SelectListItem
                {
                    Text = m.Description.ToString(), Value = Convert.ToString(m.User_Role_Status_Id)
                }).ToList();
            }


            ViewBag.Consult = consult == 1;
            if (consult == 1)
            {
                ViewBag.Operation = "Consult";
            }
            return(View(varSpartan_User_Role));
        }