Exemplo n.º 1
0
        /// <summary>
        /// Adds a generic culture error for use in displaying the culture validation error in the save/publish/etc... dialogs
        /// </summary>
        /// <param name="modelState"></param>
        /// <param name="culture"></param>
        /// <param name="segment"></param>
        /// <param name="errMsg"></param>
        internal static void AddVariantValidationError(this System.Web.Http.ModelBinding.ModelStateDictionary modelState,
                                                       string culture, string segment, string errMsg)
        {
            var key = "_content_variant_" + (culture.IsNullOrWhiteSpace() ? "invariant" : culture) + "_" + (segment.IsNullOrWhiteSpace() ? "null" : segment) + "_";

            if (modelState.ContainsKey(key))
            {
                return;
            }
            modelState.AddModelError(key, errMsg);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a generic culture error for use in displaying the culture validation error in the save/publish/etc... dialogs
        /// </summary>
        /// <param name="modelState"></param>
        /// <param name="culture"></param>
        /// <param name="errMsg"></param>
        internal static void AddCultureValidationError(this System.Web.Http.ModelBinding.ModelStateDictionary modelState,
                                                       string culture, string errMsg)
        {
            var key = "_content_variant_" + culture + "_";

            if (modelState.ContainsKey(key))
            {
                return;
            }
            modelState.AddModelError(key, errMsg);
        }