Ejemplo n.º 1
0
        public ActionResult NewAction(NewActonViewModel newActionViewModel)
        {
            ControllerResult result = ControllerResult.SuccResult;

            Pkpm.Entity.Action action = new Pkpm.Entity.Action()
            {
                Name   = newActionViewModel.ActionName,
                PathId = newActionViewModel.PathId,
                Status = newActionViewModel.ActionStatus,
                Url    = string.IsNullOrWhiteSpace(newActionViewModel.ActionuUrl) ? string.Empty : newActionViewModel.ActionuUrl.Trim()
            };
            string errorMsg = string.Empty;

            bool editResult = pathServcie.AddPathAction(action, out errorMsg);

            if (!editResult)
            {
                result         = ControllerResult.FailResult;
                result.ErroMsg = errorMsg;
            }
            else
            {
                LogUserAction("对模块按钮进行了新增操作,按钮名称为{0},按钮地址为{1},是否启用为{2}".Fmt(newActionViewModel.ActionName,
                                                                            newActionViewModel.PathId,
                                                                            newActionViewModel.ActionStatus));
            }
            return(Content(result.ToJson()));
        }
Ejemplo n.º 2
0
        public ActionResult EditAction(EditAcionViewModel editActionViewModel)
        {
            ControllerResult result = ControllerResult.SuccResult;

            Pkpm.Entity.Action action = new Pkpm.Entity.Action()
            {
                Name   = editActionViewModel.ActionName,
                PathId = editActionViewModel.PathId,
                Status = editActionViewModel.ActionStatus,
                Url    = string.IsNullOrWhiteSpace(editActionViewModel.ActionuUrl) ? string.Empty : editActionViewModel.ActionuUrl.Trim(),
                Id     = editActionViewModel.ActionId
            };
            string errorMsg = string.Empty;

            bool editResult = pathServcie.EditPathAction(action, out errorMsg);

            if (!editResult)
            {
                result         = ControllerResult.FailResult;
                result.ErroMsg = errorMsg;
            }
            else
            {
                LogUserAction("对ID为{0}的模块按钮进行了编辑操作,按钮名称为{1},按钮地址为{2},是否启用为{3}".Fmt(editActionViewModel.ActionId,
                                                                                   editActionViewModel.ActionName,
                                                                                   editActionViewModel.PathId,
                                                                                   editActionViewModel.ActionStatus));
            }
            return(Content(result.ToJson()));
        }