Example #1
0
        /// <summary>
        /// Checks if language code is valid or not.
        /// </summary>
        /// <returns></returns>
        public override void Validate(ModelStateDictionary modelState)
        {
            if (string.IsNullOrEmpty(Model))
            {
                return;
            }
            var languageInfo = codeService.GetLanguageByCode(Model);

            if (languageInfo == null || !languageInfo.Id.IsAssigned())
            {
                modelState.AddModelError(PropertyName, string.Format(CoreMessages.OpenApi.CodeNotFound, Model));
            }
        }