GetErrorStatus() public method

public GetErrorStatus ( ) : ResponseStatus
return ResponseStatus
コード例 #1
0
        public static MvcHtmlString ValidationSummary(this HtmlHelper htmlHelper, bool excludePropertyErrors, string message, IDictionary <string, object> htmlAttributes)
        {
            if (htmlHelper == null)
            {
                throw new ArgumentNullException("htmlHelper");
            }

            var errorStatus = htmlHelper.GetErrorStatus();

            if (errorStatus == null || errorStatus.Errors != null && errorStatus.Errors.Count > 0)
            {
                return(null); //just show individual field errors
            }
            var divTag = new TagBuilder("div");

            HtmlHelper.ValidationSummaryCssClassNames.Split(' ').Each(divTag.AddCssClass);
            divTag.MergeAttributes(htmlAttributes);
            divTag.InnerHtml = errorStatus.Message;
            return(divTag.ToMvcHtmlString(TagRenderMode.Normal));
        }
コード例 #2
0
        public static MvcHtmlString ValidationSuccess(this HtmlHelper htmlHelper, string message, IDictionary <string, object> htmlAttributes)
        {
            if (htmlHelper == null)
            {
                throw new ArgumentNullException("htmlHelper");
            }

            var errorStatus = htmlHelper.GetErrorStatus();

            if (message == null ||
                errorStatus != null ||
                htmlHelper.HttpRequest.HttpMethod == HttpMethods.Get)
            {
                return(null);
            }

            var divTag = new TagBuilder("div");

            HtmlHelper.ValidationSuccessCssClassNames.Split(' ').Each(divTag.AddCssClass);
            divTag.MergeAttributes(htmlAttributes);
            divTag.InnerHtml = message;
            return(divTag.ToMvcHtmlString(TagRenderMode.Normal));
        }
コード例 #3
0
 public static HtmlString ValidationSummary(this HtmlHelper html, ICollection <string> exceptFields) =>
 ViewUtils.ValidationSummary(html.GetErrorStatus(), exceptFields, null).ToHtmlString();
コード例 #4
0
 public static HtmlString ValidationSummary(this HtmlHelper html, ICollection <string> exceptFields, object divAttrs) =>
 ViewUtils.ValidationSummary(html.GetErrorStatus(), exceptFields, divAttrs.ToObjectDictionary()).ToHtmlString();
コード例 #5
0
 public static HtmlString ErrorSummary(this HtmlHelper html) =>
 ViewUtils.ValidationSummary(html.GetErrorStatus(), null).ToHtmlString();
コード例 #6
0
 /// <summary>
 /// Alias for ServiceStack Html.ValidationSummary() with comma-delimited field names
 /// </summary>
 public static HtmlString ErrorSummary(this HtmlHelper html, string exceptFor) =>
 ViewUtils.ValidationSummary(html.GetErrorStatus(), exceptFor).ToHtmlString();
コード例 #7
0
 public static string ErrorResponse(this HtmlHelper html, string fieldName) =>
 ViewUtils.ErrorResponse(html.GetErrorStatus(), fieldName);
コード例 #8
0
 public static string ErrorResponseSummary(this HtmlHelper html) =>
 ViewUtils.ErrorResponseSummary(html.GetErrorStatus());
コード例 #9
0
 public static string ErrorResponseExcept(this HtmlHelper html, ICollection <string> fieldNames) =>
 ViewUtils.ErrorResponseExcept(html.GetErrorStatus(), fieldNames);