示例#1
0
        public async Task <IActionResult> Create([Bind("Id,Name,Flag")] Countries countries)
        {
            if (ModelState.IsValid)
            {
                _context.Add(countries);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(countries));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Link,ImageLink")] Bookies bookies)
        {
            if (ModelState.IsValid)
            {
                _context.Add(bookies);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(bookies));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,Code,Country")] Leagues leagues)
        {
            if (ModelState.IsValid)
            {
                _context.Add(leagues);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Country"] = new SelectList(_context.Countries, "Id", "Name", leagues.Country);
            return(View(leagues));
        }