예제 #1
0
        public ActionResult Add(CountryView countryView)
        {
            if (ModelState.IsValid)
            {
                ICountriesRepository countriesRepository = new CountriesRepository(db);
                Country country = new Country();

                countryView.ConvertTo(countryView, country);

                countriesRepository.Add(country);
                countriesRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("INSERT", country.CountryPK);

                return(RedirectToAction("Index", "Country"));
            }
            else
            {
                return(View(countryView));
            }
        }