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