public async Task <IActionResult> Edit(int id, [Bind("ID,Nazov,Typ,Poznamky")] Stroje stroje) { if (id != stroje.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(stroje); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StrojeExists(stroje.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(stroje)); }
public async Task <IActionResult> Create([Bind("ID,Nazov,Typ,Poznamky")] Stroje stroje) { if (ModelState.IsValid) { _context.Add(stroje); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(stroje)); }