// 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(CreateOrUpdateDictionaryDto ViewModel) { if (ViewModel is null) { throw new ArgumentNullException(nameof(ViewModel)); } if (!TryValidateModel(ViewModel)) { return(BadRequest(ModelState)); } var result = await dictionaryService.CreateOrUpdateDictionaryAsync(ViewModel).ConfigureAwait(false); if (result.Succeeded) { return(new OkResult()); } ModelState.AddModelError(string.Empty, result.ErrorMessage); return(BadRequest(ModelState)); }