public ActionResult New(GenreViewModel genreViewModel) { if (ModelState.IsValid) { var genreDto = _mapper.Map <ExtendGenreDTO>(genreViewModel); if (!_genreService.IsUniqueEnName(genreDto)) { ModelState.AddModelError("NameEn", GlobalRes.ExistGenreName); } if (genreViewModel.NameRu != null) { if (!_genreService.IsUniqueRuName(genreDto)) { ModelState.AddModelError("NameRu", GlobalRes.ExistGenreName); } } if (ModelState.IsValid) { _genreService.AddNew(genreDto); return(RedirectToAction("GetAll")); } } var genres = _mapper.Map <IEnumerable <DelailsGenreViewModel> >(_genreService.GetAll()); genreViewModel.GenreList = new SelectList(genres, "Id", "Name"); return(View(genreViewModel)); }