public async Task <IActionResult> Edit(int id, [Bind("Id,CommuteTypeName,CommutePointsAwarded,CommuteTypeDescription")] CommuteType commuteType) { if (id != commuteType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(commuteType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CommuteTypeExists(commuteType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(commuteType)); }
public async Task <IActionResult> Create([Bind("Id,CommuteTypeName,CommutePointsAwarded,CommuteTypeDescription")] CommuteType commuteType) { if (ModelState.IsValid) { _context.Add(commuteType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(commuteType)); }