public async Task <IActionResult> Edit(int id, [Bind("id_viatura,matricula,marca,modelo")] VIATURA vIATURA) { if (id != vIATURA.id_viatura) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(vIATURA); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VIATURAExists(vIATURA.id_viatura)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(vIATURA)); }
public async Task <IActionResult> Create([Bind("id_viatura,matricula,marca,modelo")] VIATURA vIATURA) { if (ModelState.IsValid) { _context.Add(vIATURA); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(vIATURA)); }