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


C# JsonResultData.RunWithTry方法代码示例

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


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

示例1: 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

示例2: 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

示例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: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: Index

        public ActionResult Index(Setting setting)
        {
            JsonResultData data = new JsonResultData(ModelState);
            data.RunWithTry((resultData) =>
            {
                SettingProvider.Update(setting, setting);
                resultData.AddMessage("The setting has been saved.".Localize());
            });

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

示例10: Reject

        public virtual ActionResult Reject(string workflowName, string roleName, string UUID, string comment, string @return)
        {
            var data = new JsonResultData(ModelState);

            data.RunWithTry((resultData) =>
            {
                Manager.ProcessPendingWorkflowItem(Repository, workflowName, roleName, UUID, User.Identity.Name, false, comment);
                resultData.RedirectUrl = @return;
            });

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

示例11: Delete

 public ActionResult Delete(Blog[] model)
 {
     JsonResultData data = new JsonResultData();
     data.RunWithTry((resultData) =>
     {
         foreach (var item in model)
         {
             _provider.Delete(item);
         }
         data.RedirectUrl = Url.Action("Index", ControllerContext.RequestContext.AllRouteValues().Merge("id", null));
     });
     return Json(data);
 }
开发者ID:Qupy,项目名称:Extensions,代码行数:13,代码来源:BlogController.cs

示例12: Delete

        public virtual ActionResult Delete(string membershipName)
        {
            ModelState.Clear();
            var data = new JsonResultData(ModelState);
            data.RunWithTry((resultData) =>
            {
                _manager.Delete(new Kooboo.CMS.Member.Models.Membership() { Name = membershipName });

                data.ReloadPage = true;
            });

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

示例13: Create

 public virtual ActionResult Create(CreateRepositoryModel model)
 {
     JsonResultData data = new JsonResultData(ModelState);
     data.RunWithTry((resultData) =>
     {
         if (ModelState.IsValid)
         {
             Manager.Create(model.Name, model.Template);
             resultData.RedirectUrl = Url.Action("Index", new { controller = "home", repositoryName = model.Name });
         }
     });
     return Json(data);
 }
开发者ID:kooboo-jifeng,项目名称:CMS,代码行数:13,代码来源:RepositoryController.cs

示例14: Delete

 public virtual ActionResult Delete(Role[] model)
 {
     var data = new JsonResultData(ModelState);
     data.RunWithTry((resultData) =>
     {
         foreach (var role in model)
         {
             RoleManager.Delete(role.Name);
         }
         resultData.ReloadPage = true;
     });
     return Json(data);
 }
开发者ID:Godoy,项目名称:CMS,代码行数:13,代码来源:RolesController.cs

示例15: Create

 public ActionResult Create(RemoteEndpointSetting setting, string @return)
 {
     var resultEntry = new JsonResultData(ModelState);
     if (ModelState.IsValid)
     {
         resultEntry.RunWithTry((data) =>
         {
             _manager.Add(setting);
             data.RedirectUrl = @return;
         });
     }
     return Json(resultEntry);
 }
开发者ID:XitasoChris,项目名称:CMS,代码行数:13,代码来源:RemoteEndpointSettingController.cs


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