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