Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Link,ImageLink")] Bookies bookies)
        {
            if (id != bookies.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bookies);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BookiesExists(bookies.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(bookies));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Country,League")] Teams teams)
        {
            if (id != teams.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(teams);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TeamsExists(teams.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["Country"] = new SelectList(_context.Countries, "Id", "Name", teams.Country);
            ViewData["League"]  = new SelectList(_context.Leagues, "Id", "Name", teams.League);
            return(View(teams));
        }