public ViewResult Region() { RegionViewModel viewModel = TempData["RegionViewModel"] as RegionViewModel; if (viewModel == null || viewModel.CityName == null) { List <Town> townList = townRepository.GetAllList(); Town town = (townList.Count > 0) ? townList.First() : null; viewModel = new RegionViewModel("addTown"); viewModel.InitializeTownList(townRepository, town); viewModel.InitializeRegionList(regionRepository, town); } else { viewModel.InitializeTownList(townRepository, viewModel); viewModel.InitializeRegionList(regionRepository, viewModel); } return(View(viewModel)); }