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