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