public async Task <IActionResult> Delete(int id) { try { var dbContacts = await _contactsService.GetContactById(id); if (dbContacts != null) { await _contactsService.DeleteContactsAsync(dbContacts); } } catch (Exception) { ModelState.AddModelError("", "Unable to delete."); } return(RedirectToAction(nameof(Index))); }