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