public IActionResult DeleteContact(int id) { if (id == 0) { return(BadRequest()); } var contactToDelete = _contactsService.GetContactById(id); if (contactToDelete == null) { return(NotFound()); } try { _contactsService.DeleteContact(id); // Live Update for Client Apps _hub.Clients.All.SendAsync("LiveUpdate"); return(NoContent()); } catch (Exception ex) { log.Error("PublicAddressBookApiError: ", ex); return(StatusCode(StatusCodes.Status500InternalServerError)); } }
/// <summary> /// Deletes the existing contact information /// </summary> /// <param name="contactId"></param> /// <returns>int</returns> public int DeleteContact(int contactId) { return(_iContacts.DeleteContact(contactId)); }