public async Task <IActionResult> Edit(int id, [Bind("Id,ContactType,Name,DateOfBirth,PhoneNumber,Email")] ContactListEntry contactListEntry) { if (id != contactListEntry.Id) { return(NotFound()); } if (ModelState.IsValid) { try { var success = await _service.UpdateEntryAsync(contactListEntry); if (success) { return(RedirectToAction(nameof(Index))); } else { ViewBag.ErrorMessage = "Something went wrong while updating contact list entry, please try again ..."; } } catch (DbUpdateConcurrencyException) { var entry = await _service.GetByIdAsync(contactListEntry.Id); if (entry is null) { return(NotFound()); } else { throw; } } } return(View(contactListEntry)); }