public async Task <IActionResult> Edit(int id, [Bind("IDFornecedor,Nome,Endereco")] TBFornecedor fornecedor) { if (id != fornecedor.IDFornecedor) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(fornecedor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FornecedorExists(fornecedor.IDFornecedor)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(fornecedor)); }
public async Task <IActionResult> Create([Bind("IDFornecedor,Nome,Endereco")] TBFornecedor fornecedor) { if (ModelState.IsValid) { _context.Add(fornecedor); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(fornecedor)); }