public async Task <IActionResult> Create(BanCreateViewModel viewModel) { if (ModelState.IsValid) { var dto = _mapper.Map <BanEditDto>(viewModel); var id = await _banService.CreateAsync(dto); return(RedirectToAction("Details", new { id = id })); } else { ViewBag.ErrorMessage = ModelState.ModelErrorsToString(); return(View(viewModel)); } }