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