예제 #1
0
        public async Task <IActionResult> Create([Bind("ID,Brand,Name,Use,Support")] Shoe shoe)
        {
            if (ModelState.IsValid)
            {
                _context.Add(shoe);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(shoe));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("ID,RaceDate,RaceName,City,State")] Race race)
        {
            if (ModelState.IsValid)
            {
                _context.Add(race);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(race));
        }
예제 #3
0
        public async Task <IActionResult> Create([Bind("ID,FirstName,LastName,Age,Address,City,State,Zip,Email,PhoneNumber,RaceId,ShoeId")] Registrant registrant)
        {
            if (ModelState.IsValid)
            {
                _context.Add(registrant);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RaceId"] = new SelectList(_context.Race, "ID", "RaceName", registrant.RaceId);
            ViewData["ShoeId"] = new SelectList(_context.Shoe, "ID", "Brand", registrant.ShoeId);
            return(View(registrant));
        }