コード例 #1
0
 public string Save(Model.AppLibrary appLibraryModel)
 {
     if (!ModelState.IsValid)
     {
         return(Tools.GetValidateErrorMessag(ModelState));
     }
     Business.AppLibrary appLibrary = new Business.AppLibrary();
     if (Request.Querys("id").IsGuid(out Guid guid))
     {
         var    oldModel = appLibrary.Get(guid);
         string oldJSON  = null == oldModel ? "" : oldModel.ToString();
         appLibrary.Update(appLibraryModel);
         Business.Log.Add("修改了应用程序库-" + appLibraryModel.Title, type: Business.Log.Type.系统管理, oldContents: oldJSON, newContents: appLibraryModel.ToString());
     }
     else
     {
         appLibrary.Add(appLibraryModel);
         Business.Log.Add("添加了应用程序库-" + appLibraryModel.Title, appLibraryModel.ToString(), Business.Log.Type.系统管理);
     }
     return("保存成功!");
 }
コード例 #2
0
        public IActionResult Edit()
        {
            string id         = Request.Querys("id");
            string appId      = Request.Querys("appid");
            string tabId      = Request.Querys("tabid");
            string typeId     = Request.Querys("typeid");
            string pageSize   = Request.Querys("pagesize");
            string pageNumber = Request.Querys("pagenumber");

            Business.AppLibrary appLibrary      = new Business.AppLibrary();
            Model.AppLibrary    appLibraryModel = null;
            if (id.IsGuid(out Guid guid))
            {
                appLibraryModel = appLibrary.Get(guid);
            }
            if (null == appLibraryModel)
            {
                appLibraryModel = new Model.AppLibrary()
                {
                    Id = Guid.NewGuid(),
                };
                if (typeId.IsGuid(out Guid type))
                {
                    appLibraryModel.Type = type;
                }
            }

            ViewData["typeOptions"]      = new Business.Dictionary().GetOptionsByCode("system_applibrarytype", value: appLibraryModel.Type.ToString());
            ViewData["openModelOptions"] = new Business.Dictionary().GetOptionsByCode("system_appopenmodel", Business.Dictionary.ValueField.Value, appLibraryModel.OpenMode.ToString());
            ViewData["appId"]            = appId;
            ViewData["tabId"]            = appId;
            ViewData["typeId"]           = typeId;
            ViewData["pageSize"]         = pageSize;
            ViewData["pageNumber"]       = pageNumber;
            ViewData["queryString"]      = Request.UrlQuery();

            return(View(appLibraryModel));
        }