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


C# ContentResult.ExecuteResult方法代码示例

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


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

示例1: ExecuteResult

 public override void ExecuteResult(ControllerContext context)
 {
     ContentResult result = new ContentResult
     {
         Content = Content,
         ContentEncoding = ContentEncoding ?? Encoding.UTF8,
         ContentType = ContentType
     };
     result.ExecuteResult(context);
 }
开发者ID:cgyqu,项目名称:EasyUIFramwork,代码行数:10,代码来源:APIContentResult.cs

示例2: ExecuteResult

        /// <summary>
        /// Enables processing of the result of an action method by a custom type that inherits from the <see cref="T:System.Web.Mvc.ActionResult" /> class.
        /// </summary>
        /// <param name="context">The context in which the result is executed. The context information includes the controller, HTTP content, request context, and route data.</param>
        /// <exception cref="NotImplementedException"></exception>
        public override void ExecuteResult(ControllerContext context)
        {
            this.Result.ExecuteResult(context);

              var script = Sitecore.Context.Items[Constants.MvcWebFormRulesScriptKey] as string;
              if (!string.IsNullOrEmpty(script))
              {
            var content = new ContentResult { Content = InlineJs.SafeScriptWrapping.FormatWith(script) };
            content.ExecuteResult(context);
              }
        }
开发者ID:zigor,项目名称:morph,代码行数:16,代码来源:JsEmbededFormActionResult.cs

示例3: ExecuteResult

        public override void ExecuteResult(ControllerContext context)
        {
            string errorMessage = null;
            if (context.Controller.ViewData.ModelState.IsValid)
            {
                try
                {
                    service();
                    ObjectFactory.GetInstance<DatabaseContext>().SaveChanges();
                }
                catch (Exception e)
                {
                    e = this.Unwrap(e);
                    errorMessage = e.Message;
                }
            }

            if (context.HttpContext.Request.IsAjaxRequest())
            {
                ContentResult result = new ContentResult { Content = errorMessage ?? string.Empty };
                result.ExecuteResult(context);
                return;
            }

            if (!context.Controller.ViewData.ModelState.IsValid ||
                !string.IsNullOrEmpty(errorMessage))
            {
                if (onError != null) onError();

                if (context.RouteData.Values["action"].ToString().Equals("eliminar", StringComparison.OrdinalIgnoreCase))
                {
                    context.Controller.TempData.Add("message", errorMessage);
                }
                else
                {
                    context.Controller.ViewData.ModelState.AddModelError("", errorMessage);
                    errorView.ViewData = context.Controller.ViewData;
                    errorView.TempData = context.Controller.TempData;
                    errorView.ExecuteResult(context);
                    return;
                }
            }

            foreach (string key in context.HttpContext.Request.QueryString.Keys)
            {
                successAction.RouteValues.Add(key, context.HttpContext.Request.QueryString[key]);
            }
            successAction.ExecuteResult(context);
        }
开发者ID:jmptrader,项目名称:Switch-Transaccional,代码行数:49,代码来源:ServiceActionResult.cs

示例4: ExecuteResult

        public override void ExecuteResult(ControllerContext context)
        {
            //if (context.RequestContext.HttpContext.Request.IsAjaxRequest())
            //{
            string destinationUrl = UrlHelper.GenerateContentUrl(Url, context.HttpContext);

            //JavaScriptResult result = new JavaScriptResult()
            //{
            //    Script = String.Format("<ajaxScript>window.authRedirect ? window.authRedirect('{0}') : window.location='{0}';</ajaxScript>", destinationUrl)
            //};
            //result.ExecuteResult(context);

            ContentResult result = new ContentResult();
            result.Content = HttpUtility.HtmlEncode(String.Format("<ajaxScript>window.location='{0}'</ajaxScript>", destinationUrl));
            result.ExecuteResult(context);
            //}
            //else
            //    base.ExecuteResult(context);
        }
开发者ID:seavan,项目名称:bewell-travel,代码行数:19,代码来源:AjaxAwareRedirectResult.cs

示例5: ExecuteResult

        public override void ExecuteResult(ControllerContext context)
        {
            var itemSeparator = ";";

            var sb = new StringBuilder();

            if (Data == null) {
                return;	// do nothing
            }

            var firstRow = Data.Rows.FirstOrDefault();

            if (firstRow == null) {
                return;	// do nothing
            }

            foreach (var field in firstRow.Fields) {
                sb.Append(field.DisplayName + itemSeparator);
            }

            sb.AppendLine();

            foreach (var record in Data.Rows) {
                foreach (var field in record.Fields) {
                    sb.Append((field.Data != null) ? field.Data.ToString() : String.Empty);
                    sb.Append(itemSeparator);
                }
                sb.AppendLine();
            }

            var result = new ContentResult {
                ContentType = "text/csv",
                Content = sb.ToString(),
                ContentEncoding = Encoding.Default
            };

            result.ExecuteResult(context);
        }
开发者ID:felipecsl,项目名称:dover,代码行数:38,代码来源:CsvResult.cs

示例6: ExecuteResult

 public override void ExecuteResult(ControllerContext context)
 {
     var cr = new ContentResult();
     if (Mode == RenderMode.Html)
     {
         cr.ContentType = "text/html";
         cr.Content = mHTML;
     }
     else if (Mode == RenderMode.Text)
     {
         cr.ContentType = "text/plain";
         cr.Content = mText;
     }
     else if (Mode == RenderMode.Json)
     {
         JsonResult jr = new JsonResult();
         jr.Data = new
         {
             mMessage.From,
             mMessage.To,
             mMessage.CC,
             mMessage.Bcc,
             mMessage.Headers,
             mMessage.Priority,
             mMessage.ReplyToList,
             mMessage.Sender,
             mMessage.Subject,
             mMessage.SubjectEncoding
         };
         jr.ExecuteResult(context);
         return;
     }
     else
     {
         new SmtpClient().Send(mMessage);
         if (Mode == RenderMode.SendWithJson)
         {
             var jr = new JsonResult();
             jr.Data = new { success = true };
             jr.ExecuteResult(context);
             return;
         }
         cr.Content = "OK";
     }
     cr.ExecuteResult(context);
 }
开发者ID:djMax,项目名称:AlienForce,代码行数:46,代码来源:EmailResult.cs

示例7: ExecuteResult

        /// <summary>
        /// Renders the correct result to the client
        /// </summary>
        public override void ExecuteResult(ControllerContext context)
        {
            //finalize the content
            if (this.Element is CobaltControl) {
                (this.Element as CobaltControl).PerformFinalize();
            }

            //execute a content result with the markup
            ContentResult result = new ContentResult() {
                Content = this.Element.ToString(),
                ContentType = this.ContentType,
                ContentEncoding = this.Encoding
            };

            //and finalize the content
            result.ExecuteResult(context);
        }
开发者ID:hugoware,项目名称:CobaltMVC,代码行数:20,代码来源:CobaltResult.cs


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