Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("StatId,ChampId,WinRate,PickRate,BanRate,Tier,LanePlayed")] ChampStat champStat)
        {
            if (id != champStat.StatId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(champStat);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ChampStatExists(champStat.StatId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ChampId"] = new SelectList(_context.Champion, "ChampId", "ChampId", champStat.ChampId);
            return(View(champStat));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("StatId,ChampId,WinRate,PickRate,BanRate,Tier,LanePlayed")] ChampStat champStat)
        {
            if (ModelState.IsValid)
            {
                _context.Add(champStat);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ChampId"] = new SelectList(_context.Champion, "ChampId", "ChampId", champStat.ChampId);
            return(View(champStat));
        }