Beispiel #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Brand,Name,Use,Support")] Shoe shoe)
        {
            if (id != shoe.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(shoe);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShoeExists(shoe.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(shoe));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,FirstName,LastName,Age,Address,City,State,Zip,Email,PhoneNumber,RaceId,ShoeId")] Registrant registrant)
        {
            if (id != registrant.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(registrant);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RegistrantExists(registrant.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                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));
        }
Beispiel #3
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,RaceName,City,State")] Race race)
        {
            if (id != race.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(race);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RaceExists(race.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(race));
        }