예제 #1
0
        public IActionResult Edit(string appCode)
        {
            IAppInfo model;

            if (string.IsNullOrEmpty(appCode))
            {
                model = new DtoAppInfo();
            }
            else
            {
                model = this._service.GetAppInfo(appCode);
            }

            return(View(model));
        }
예제 #2
0
 private static bool ValidateAppInfo(DtoAppInfo entity, out string errMsg)
 {
     errMsg = "";
     if (entity == null)
     {
         errMsg = "应用信息为空,请刷新后重试";
         return(false);
     }
     if (string.IsNullOrEmpty(entity.AppCode))
     {
         errMsg += "应用编码不能为空";
     }
     if (string.IsNullOrEmpty(entity.AppName))
     {
         errMsg += "应用名称不能为空";
     }
     return(string.IsNullOrEmpty(errMsg));
 }
예제 #3
0
        public async Task <IActionResult> SaveAppInfo(int type, DtoAppInfo entity)
        {
            JsonMsg msg = new JsonMsg();

            try
            {
                string errMsg;
                bool   valid = ValidateAppInfo(entity, out errMsg);
                if (!valid)
                {
                    msg.status  = -1;
                    msg.message = errMsg;
                    return(Json(msg));
                }
                entity.LastModifyTime     = DateTime.Now;
                entity.LastModifyUserId   = base.UserId;
                entity.LastModifyUserName = base.UserId;

                int ret = await this._service.SaveAppInfo(entity, type);

                if (ret > 0)
                {
                    msg.status = 0;
                }
                else
                {
                    msg.status  = -1;
                    msg.message = "操作不成功,请稍后重试";
                }
            }
            catch (Exception ex)
            {
                msg.status  = -1;
                msg.message = "操作不成功:" + ex.Message;
            }
            return(Json(msg));
        }