Exemplo n.º 1
0
        /// <summary>
        /// 判断功能标识是否已经存在
        /// </summary>
        public APIResponseEntity <bool> IsExistCode(APIRequestEntity <XCLCMS.Data.WebAPIEntity.RequestEntity.SysFunction.IsExistCodeEntity> request)
        {
            var response = new APIResponseEntity <bool>();

            response.IsSuccess = true;
            response.Message   = "该标识可以使用!";

            XCLCMS.Data.Model.SysFunction model = null;
            if (request.Body.SysFunctionID > 0)
            {
                model = sysFunctionBLL.GetModel(request.Body.SysFunctionID);
                if (null != model)
                {
                    if (string.Equals(request.Body.Code, model.Code, StringComparison.OrdinalIgnoreCase))
                    {
                        return(response);
                    }
                }
            }
            if (!string.IsNullOrEmpty(request.Body.Code))
            {
                bool isExist = sysFunctionBLL.IsExistCode(request.Body.Code);
                if (isExist)
                {
                    response.IsSuccess = false;
                    response.Message   = "该标识名已存在!";
                }
            }
            return(response);
        }
Exemplo n.º 2
0
        public APIResponseEntity <bool> IsExistCode([FromUri] string json)
        {
            var request  = Newtonsoft.Json.JsonConvert.DeserializeObject <APIRequestEntity <XCLCMS.Data.WebAPIEntity.RequestEntity.SysFunction.IsExistCodeEntity> >(System.Web.HttpUtility.UrlDecode(json));
            var response = new APIResponseEntity <bool>();

            response.IsSuccess = true;
            response.Message   = "该标识可以使用!";

            XCLCMS.Data.Model.SysFunction model = null;
            if (request.Body.SysFunctionID > 0)
            {
                model = sysFunctionBLL.GetModel(request.Body.SysFunctionID);
                if (null != model)
                {
                    if (string.Equals(request.Body.Code, model.Code, StringComparison.OrdinalIgnoreCase))
                    {
                        return(response);
                    }
                }
            }
            if (!string.IsNullOrEmpty(request.Body.Code))
            {
                bool isExist = sysFunctionBLL.IsExistCode(request.Body.Code);
                if (isExist)
                {
                    response.IsSuccess = false;
                    response.Message   = "该标识名已存在!";
                }
            }
            return(response);
        }