public async Task <IActionResult> Create([Bind("id,nome,preco,quantidade")] Produto produto)
        {
            if (ModelState.IsValid)
            {
                _context.Add(produto);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(produto));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,Nome,Nascimento,Altura")] Client client)
        {
            if (ModelState.IsValid)
            {
                _context.Add(client);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(client));
        }
예제 #3
0
 public void Inserir(Categoria categoria)
 {
     _context.Add(categoria);
     _context.SaveChanges();
 }