Пример #1
0
        public IHttpActionResult Delete([FromUri] int roleSeqId)
        {
            string        mRetVal       = "false";
            MSecurityInfo mSecurityInfo = new MSecurityInfo(FunctionUtility.GetProfile(ConfigSettings.GetAppSettingValue("Actions_EditRoles", true)), AccountUtility.CurrentProfile());

            if (!mSecurityInfo.MayDelete)
            {
                Exception mError = new Exception("The account (" + AccountUtility.CurrentProfile().Account + ") being used does not have the correct permissions to delete");
                Logger    mLog   = Logger.Instance();
                mLog.Error(mError);
                return(this.InternalServerError(mError));
            }
            else
            {
                if (HttpContext.Current.Items["EditId"] != null)
                {
                    int mEditId = int.Parse(HttpContext.Current.Items["EditId"].ToString());
                    if (mEditId == roleSeqId)
                    {
                        MRoleProfile mProfile = RoleUtility.GetProfile(roleSeqId);
                        RoleUtility.DeleteRole(mProfile);
                    }
                    else
                    {
                        Exception mError = new Exception("Identifier you have last looked at does not match the one passed in nothing has been saved!!!!");
                        Logger    mLog   = Logger.Instance();
                        mLog.Error(mError);
                        return(this.InternalServerError(mError));
                    }
                }
                else
                {
                    Exception mError = new Exception("The identifier unknown and nothing has been saved!!!!");
                    Logger    mLog   = Logger.Instance();
                    mLog.Error(mError);
                    return(this.InternalServerError(mError));
                }
            }

            return(Ok(mRetVal));
        }