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