// To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync(CreateOrUpdateDictionaryTypeDto ViewModel)
        {
            if (ViewModel is null)
            {
                throw new ArgumentNullException(nameof(ViewModel));
            }

            if (!TryValidateModel(ViewModel))
            {
                return(BadRequest(ModelState));
            }

            var result = await dictionaryService.CreateOrUpdateDictionaryTypeAsync(ViewModel).ConfigureAwait(false);

            if (result.Succeeded)
            {
                return(new OkResult());
            }

            ModelState.AddModelError(string.Empty, result.ErrorMessage);
            return(BadRequest(ModelState));
        }