public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Contact,Company,Supervisor")] DispatchRider dispatchRider) { if (id != dispatchRider.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(dispatchRider); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DispatchRiderExists(dispatchRider.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(dispatchRider)); }
public async Task <IActionResult> Create([Bind("Id,Name,Contact,Company,Supervisor")] DispatchRider dispatchRider) { if (ModelState.IsValid) { _context.Add(dispatchRider); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(dispatchRider)); }