Пример #1
0
        public ActionResult SysVarAddEdit(BackEndSysVarAddEdit sysVarAddEdit)
        {
            string  username   = BackEndSessions.CurrentUser.UserName;
            SysVars categories = new SysVars();
            string  currentId  = sysVarAddEdit.Sys_Id;

            if (ModelState.IsValidOrRefresh())
            {
                var rs = categories.AddEdit(
                    currentId,
                    sysVarAddEdit.Sys_Var,
                    sysVarAddEdit.Sys_Type,
                    sysVarAddEdit.Sys_Value,
                    sysVarAddEdit.Sys_Name,
                    sysVarAddEdit.IsEditable,
                    username
                    );
                switch (rs)
                {
                case 0:
                    ModelState.AddResult(ViewData, ModelStateResult.Success, Resources.Strings.ItemSuccessfullyAddEdit);
                    break;

                case 2:
                    ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.ItemDoesNotExist);
                    break;

                default:
                    ModelState.AddResult(ViewData, ModelStateResult.Error, Resources.Strings.UnexpectedError);
                    break;
                }
            }
            return(View(sysVarAddEdit));
        }
Пример #2
0
        public ActionResult SysVarAddEdit(string id)
        {
            BackEndSysVarAddEdit sysVarAddEdit = new BackEndSysVarAddEdit();

            if (id.IsNotNull())
            {
                SysVars sysVars = new SysVars();
                var     sysVar  = sysVars.FilterById(id);
                if (sysVar.IsNotNull())
                {
                    sysVarAddEdit.Sys_Id     = sysVar.Sys_Id;
                    sysVarAddEdit.Sys_Var    = sysVar.Sys_Var;
                    sysVarAddEdit.Sys_Type   = sysVar.Sys_Type;
                    sysVarAddEdit.Sys_Value  = sysVar.Sys_Value;
                    sysVarAddEdit.Sys_Name   = sysVar.Sys_Name;
                    sysVarAddEdit.IsEditable = sysVar.IsEditable;
                }
            }
            return(View(sysVarAddEdit));
        }