示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("LeilaoID,Nome,ValorInicial,Usado,DataAbertura,DataFinalizacao")] Leilao leilao)
        {
            if (id != leilao.LeilaoID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(leilao);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LeilaoExists(leilao.LeilaoID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(leilao));
        }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("LanceID,Valor,UserId,LeilaoID")] Lance lance)
        {
            if (id != lance.LanceID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(lance);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LanceExists(lance.LanceID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LeilaoID"] = new SelectList(_context.Leiloes, "LeilaoID", "LeilaoID", lance.LeilaoID);
            return(View(lance));
        }