public IActionResult Create(CountryFormViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            this.countries.Create(model.Name, (Continent)model.Continent);

            this.TempData.AddSuccessMessage(string.Format(SuccessfullAdd, model.Name));

            return(RedirectToAction(nameof(All)));
        }
Beispiel #2
0
        public ActionResult Create(CountryFormViewModel countryForm)
        {
            if (ModelState.IsValid)
            {
                var country = Mapper.Map <CountryFormViewModel, Country>(countryForm);

                countryService.CreateCountry(country);
                countryService.SaveCountry();
                return(RedirectToAction("Index"));
            }
            return(View(countryForm));
        }