예제 #1
0
        public async Task <IActionResult> Create([Bind("LeilaoID,Nome,ValorInicial,Usado,DataAbertura,DataFinalizacao")] Leilao leilao)
        {
            if (ModelState.IsValid)
            {
                _context.Add(leilao);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(leilao));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("LanceID,Valor,UserId,LeilaoID")] Lance lance)
        {
            if (ModelState.IsValid)
            {
                _context.Add(lance);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LeilaoID"] = new SelectList(_context.Leiloes, "LeilaoID", "LeilaoID", lance.LeilaoID);
            return(View(lance));
        }