public async Task <IActionResult> Edit(int id, [Bind("Id,LocationName,EntryDate,LocationType,Rate")] RunningSpot runningSpot) { if (id != runningSpot.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(runningSpot); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RunningSpotExists(runningSpot.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(runningSpot)); }
public async Task <IActionResult> Create([Bind("Id,LocationName,EntryDate,LocationType,Rate")] RunningSpot runningSpot) { if (ModelState.IsValid) { _context.Add(runningSpot); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(runningSpot)); }