Beispiel #1
0
        public async Task <IActionResult> Create([Bind("ID,Name,Continent,Foundation")] Country country)
        {
            if (ModelState.IsValid)
            {
                _context.Add(country);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(country));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("ID,LastName,FirstName,BornDate,Height,Weight,CountryID")] Player player)
        {
            if (ModelState.IsValid)
            {
                _context.Add(player);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["CountryID"] = new SelectList(_context.Countries, "ID", "ID", player.CountryID);
            return(View(player));
        }