当前位置: 首页>>代码示例>>C#>>正文


C# Common.JsonResultData类代码示例

本文整理汇总了C#中Kooboo.CMS.Common.JsonResultData的典型用法代码示例。如果您正苦于以下问题:C# JsonResultData类的具体用法?C# JsonResultData怎么用?C# JsonResultData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JsonResultData类属于Kooboo.CMS.Common命名空间,在下文中一共展示了JsonResultData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Delete

        public virtual ActionResult Delete(string[] docs, string[] folders)
        {
            var data = new JsonResultData(ModelState);
            data.RunWithTry((resultData) =>
            {
                var category = ControllerContext.RequestContext.GetRequestValue("Category");

                if (docs != null)
                {
                    foreach (var uuid in docs)
                    {
                        var label = new Label() { Site = Site, UUID = uuid };
                        Remove(label);
                    }
                }

                if (folders != null)
                {
                    foreach (var c in folders)
                    {
                        Manager.RemoveCategory(Site, c);
                    }
                }

                resultData.ReloadPage = true;
            });
            return Json(data);
        }
开发者ID:nishizhen,项目名称:CMS,代码行数:28,代码来源:LabelController.cs

示例2: Create

        public virtual ActionResult Create(TextFolder model, string folderName, string @return)
        {
            //compatible with the Folder parameter changed to FolderName.
            folderName = folderName ?? this.ControllerContext.RequestContext.GetRequestValue("Folder");

            var data = new JsonResultData(ModelState);
            if (ModelState.IsValid)
            {
                data.RunWithTry((resultData) =>
                {

                    Folder parent = null;
                    if (!string.IsNullOrEmpty(folderName))
                    {
                        parent = FolderHelper.Parse<TextFolder>(Repository, folderName);
                    }
                    model.Parent = parent;
                    model.UtcCreationDate = DateTime.UtcNow;
                    Manager.Add(Repository, model);

                    resultData.RedirectUrl = @return;
                });

            }

            return Json(data);
        }
开发者ID:jason1234,项目名称:CMS,代码行数:27,代码来源:TextFolderController.cs

示例3: Ajax

        public virtual ActionResult Ajax(LoginModel loginModel, int redirect)
        {
            var data = new JsonResultData(ModelState);
            if (ModelState.IsValid)
            {
                data.RunWithTry((resultData) =>
                {
                    if (UserServices.ValidateUser(loginModel.UserName, loginModel.Password) != null)
                    {
                        System.Web.Security.FormsAuthentication.SetAuthCookie(loginModel.UserName, loginModel.RememberMe);
                        if (redirect == 0)
                        {
                            resultData.RedirectUrl = Request.UrlReferrer.ToString();
                        }
                        else
                        {
                            resultData.RedirectUrl = System.Web.Security.FormsAuthentication.DefaultUrl;
                        }

                    }
                    else
                    {
                        resultData.AddFieldError("UserName", "Username and/or password are incorrect.".Localize());
                    }
                });
            }
            return Json(data);
        }
开发者ID:royaso,项目名称:CMS,代码行数:28,代码来源:LogOnController.cs

示例4: CopyContent

 public virtual ActionResult CopyContent(string schema, string uuid)
 {
     var data = new JsonResultData(ModelState);
     data.RunWithTry((resultData) =>
     {
         var content = Kooboo.CMS.Content.Services.ServiceFactory.TextContentManager.Copy(new Schema(Repository.Current, schema), uuid);
         resultData.Model = new
         {
             uuid = content.UUID,
             schema = content.SchemaName,
             published = string.Empty,
             editUrl = Url.Action("InlineEdit", new
             {
                 controller = "TextContent",
                 Area = "Contents",
                 RepositoryName = content.Repository,
                 SiteName = Site.FullName,
                 FolderName = content.FolderName,
                 UUID = content.UUID
             }),
             summary = HttpUtility.HtmlAttributeEncode(content.GetSummary())
         };
     });
     return Json(data);
 }
开发者ID:jason1234,项目名称:CMS,代码行数:25,代码来源:InlineEditingController.cs

示例5: Install

        public virtual ActionResult Install(InstallModuleModel installModel, string @return)
        {
            var data = new JsonResultData(ModelState);
            if (ModelState.IsValid)
            {
                data.RunWithTry((resultData) =>
                {
                    var moduleFile = this.Request.Files["ModuleFile"];

                    StringBuilder log = new StringBuilder();
                    var moduleName = System.IO.Path.GetFileNameWithoutExtension(moduleFile.FileName);

                    var moduleInfo = Manager.Install(moduleName, moduleFile.InputStream, ref log);

                    if (moduleInfo == null && log.Length != 0)
                    {
                        data.Success = false;
                        data.AddMessage(log.ToString());
                    }
                    else
                    {
                        data.RedirectUrl = @return;
                    }
                });
            }

            return Json(data);
        }
开发者ID:ebojangi,项目名称:CMS,代码行数:28,代码来源:ModuleManagementController.cs

示例6: Install

        public virtual ActionResult Install(InstallModuleModel installModel, string @return)
        {
            var data = new JsonResultData(ModelState);
            if (ModelState.IsValid)
            {
                data.RunWithTry((resultData) =>
                {
                    var moduleFile = this.Request.Files["ModuleFile"];

                    StringBuilder log = new StringBuilder();
                    var moduleName = System.IO.Path.GetFileNameWithoutExtension(moduleFile.FileName);

                    var moduleInfo = Manager.Install(moduleName, moduleFile.InputStream, ref log);

                    if (moduleInfo == null && log.Length != 0)
                    {
                        data.Success = false;
                        data.AddMessage(log.ToString());
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(moduleInfo.InstallingTemplate))
                        {
                            data.RedirectUrl = Url.Action("OnInstalling", ControllerContext.RequestContext.AllRouteValues().Merge("ModuleName", moduleName));
                        }
                        else
                        {
                            data.RedirectUrl = @return;
                        }
                    }
                });
            }

            return Json(data);
        }
开发者ID:jason1234,项目名称:CMS,代码行数:35,代码来源:ModuleManagementController.cs

示例7: Submit

        public System.Web.Mvc.ActionResult Submit(Sites.Models.Site site, System.Web.Mvc.ControllerContext controllerContext, Sites.Models.SubmissionSetting submissionSetting)
        {
            var request = controllerContext.HttpContext.Request;
            var action = request["action"];

            var jsonResultData = new JsonResultData();
            object result = null;

            try
            {
                if (action == "get-addresses")
                {
                    result = GetAddresses(site, controllerContext);
                }

                jsonResultData.Success = true;
                jsonResultData.Model = result;
            }
            catch (Exception ex)
            {
                jsonResultData.Success = false;
                jsonResultData.AddException(ex);
            }

            return new JsonResult { Data = jsonResultData, JsonRequestBehavior = JsonRequestBehavior.AllowGet };
        }
开发者ID:Wipcore,项目名称:Ecommerce,代码行数:26,代码来源:ShippingPlugin.cs

示例8: Delete

        public virtual ActionResult Delete(string[] docs, string[] folders)
        {
            var data = new JsonResultData(ModelState);
            data.RunWithTry((resultData) =>
            {
                var category = ControllerContext.RequestContext.GetRequestValue("Category");

                if (docs != null)
                {
                    foreach (var name in docs)
                    {
                        var m = new Element() { Name = name };
                        m.Category = category;
                        Remove(m);
                    }
                }

                if (folders != null)
                {
                    foreach (var c in folders)
                    {
                        Manager.RemoveCategory(Site, c);
                    }
                }

                resultData.ReloadPage = true;
            });
            return Json(data);
        }
开发者ID:nikolai80,项目名称:CMS,代码行数:29,代码来源:LabelController.cs

示例9: Create

        public virtual ActionResult Create(string[] folderName, SendingSetting sendingSetting, string @return)
        {
            if (folderName == null || folderName.Length == 0)
            {
                ModelState.AddModelError("FolderName", "Folder name is required.".Localize());
            }
            var data = new JsonResultData(ModelState);
            data.RunWithTry((resultData) =>
            {
                if (ModelState.IsValid)
                {
                    foreach (var item in folderName)
                    {
                        if (Manager.Get(Repository, item) == null)
                        {
                            sendingSetting.FolderName = item;
                            Manager.Add(Repository, sendingSetting);
                        }

                    }
                    resultData.RedirectUrl = @return;
                }
            });
            return Json(data);
        }
开发者ID:Rufius,项目名称:CMS,代码行数:25,代码来源:SendingSettingController.cs

示例10: Import

 public virtual ActionResult Import(TextContentImportModel model, string @return)
 {
     var data = new JsonResultData(ModelState);
     data.RunWithTry((resultData) =>
     {
         model.TextContentExporter.Import(new TextFolder(Repository, model.FolderName), model.File.InputStream);
         data.RedirectUrl = @return;
     });
     return Json(data);
 }
开发者ID:Qupy,项目名称:Extensions,代码行数:10,代码来源:TextContentController.cs

示例11: Delete

        public virtual ActionResult Delete(Workflow[] model)
        {
            var data = new JsonResultData(ModelState);
            data.RunWithTry((resultData) =>
            {
                Manager.Delete(model, Repository);
            });

            return Json(data);
        }
开发者ID:ebojangi,项目名称:CMS,代码行数:10,代码来源:WorkflowController.cs

示例12: CreateFolder

        public virtual ActionResult CreateFolder(string folderPath, string folderName, string @return)
        {
            var data = new JsonResultData(ModelState);
            data.RunWithTry((resultData) =>
            {
                FileManager.AddDirectory(Site, folderPath, folderName);

                data.ReloadPage = true;
            });
            return Json(data);
        }
开发者ID:ebojangi,项目名称:CMS,代码行数:11,代码来源:FileController.cs

示例13: Copy

        public virtual ActionResult Copy(CopyModel copyModel, string @return)
        {
            var data = new JsonResultData(ModelState);
            data.RunWithTry((resultData) =>
            {
                Manager.Copy(Repository, copyModel.UUID, copyModel.DestinationName);
                data.RedirectUrl = @return;
            });

            return Json(data);
        }
开发者ID:night-king,项目名称:CMS,代码行数:11,代码来源:ContentTypeController.cs

示例14: Delete

 public ActionResult Delete(DeleteModel[] model)
 {
     var resultEntry = new JsonResultData(ModelState);
     if (ModelState.IsValid)
     {
         var uuids = model.Select(it => it.UUID).ToArray();
         this._manager.Delete(uuids);
         resultEntry.ReloadPage = true;
     }
     return Json(resultEntry);
 }
开发者ID:XitasoChris,项目名称:CMS,代码行数:11,代码来源:IncomingQueueController.cs

示例15: Index

 public virtual ActionResult Index(string body)
 {
     JsonResultData data = new JsonResultData(ModelState);
     data.RunWithTry((resultData) =>
     {
         Robots_Txt robot_txt = new Robots_Txt(Site);
         robot_txt.Save(body);
         data.AddMessage("The robots.txt has been saved.".Localize());
     });
     return Json(data);
 }
开发者ID:night-king,项目名称:CMS,代码行数:11,代码来源:Robots_TxtController.cs


注:本文中的Kooboo.CMS.Common.JsonResultData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。