public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] ActivityType activityType) { if (id != activityType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _repository.UpdateEntity(activityType); await _repository.SaveAllAsync(); } catch (DbUpdateConcurrencyException) { if (!await _repository.ActivityTypeExistsAsync(activityType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(activityType)); }