Пример #1
0
        /// <summary>
        /// Checks if country code is valid or not.
        /// </summary>
        /// <returns></returns>
        public override void Validate(ModelStateDictionary modelState)
        {
            if (string.IsNullOrEmpty(Model))
            {
                return;
            }
            var country = codeService.GetCountryByCode(Model);

            if (string.IsNullOrEmpty(country))
            {
                modelState.AddModelError(PropertyName, string.Format(CoreMessages.OpenApi.CodeNotFound, Model));
            }
        }