public IActionResult AddLanguage(AddLanguageViewModel model) { if (ModelState.IsValid) { if (model.Identifier.Length == 2) { var response = _localizationService.AddLanguage(model); if (response.IsSuccess) { return(RedirectToAction("GetLanguages", "Localization")); } foreach (var e in response.Errors) { ModelState.AddModelError(e.Key, e.Message); } return(View(model)); } ModelState.AddModelError(string.Empty, "Identifier must have only 2 characters"); return(View(model)); } ModelState.AddModelError(string.Empty, "Something is not right"); return(View(model)); }