public async Task <IActionResult> Edit(int id, [Bind("Id,City,Population")] DemoStatistic demoStatistic) { if (id != demoStatistic.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(demoStatistic); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DemoStatisticExists(demoStatistic.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(demoStatistic)); }
public async Task <IActionResult> Create([Bind("Id,City,Population")] DemoStatistic demoStatistic) { if (ModelState.IsValid) { _context.Add(demoStatistic); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(demoStatistic)); }