Exemplo n.º 1
0
        public IActionResult AddCountry(Country country)
        {
            var name = _db.Countries().FindAll(a => a.Name == country.Name).Count();

            if (name == 0)
            {
                if (ModelState.IsValid)
                {
                    _db.AddCountry(country);

                    return(RedirectToAction(nameof(Country)));
                }
            }
            ViewBag.Message = "already exists";
            return(View());
        }