/// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <param name="actionId"></param>
        /// <returns></returns>
        public bool HasPermission(ActionExecutingContext context, string actionId)
        {
            var identity = (context.HttpContext.User.Identity as MvcIdentity);

            if (identity.IsAuthenticated)
            {
                var role = RolePermissions.SingleOrDefault(x => x.Id == identity.RoleId);
                if (role != null && role.Menus.Contains(actionId))
                {
                    return(true);
                }
                if (context.HttpContext.IsAjaxRequest())
                {
                    Result result = new Result();
                    result.SetStatus(ErrorCode.Forbidden);
                    context.Result = new ObjectResult(result);
                }
                else
                {
                    var view = new ViewResult();
                    view.ViewName  = "~/Views/Home/Welcome.cshtml";
                    context.Result = view;
                }
                return(false);
            }
            return(true);
        }