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