public async Task <IActionResult> Edit(int id, [Bind("IDCategoria,Descricao")] TBCategoria tBCategoria) { if (id != tBCategoria.IDCategoria) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tBCategoria); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TBCategoriaExists(tBCategoria.IDCategoria)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tBCategoria)); }
public async Task <IActionResult> Create([Bind("IDCategoria,Descricao")] TBCategoria tBCategoria) { if (ModelState.IsValid) { _context.Add(tBCategoria); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tBCategoria)); }