public async Task <IActionResult> EditContact(string id, [FromBody] ContactViewModel editedContact) { try { await _service.EditContact(id, editedContact); return(Ok("Contact Edited.")); } catch (Exception ex) { _logger.LogError($"An exception occurred while editing the contact: {ex.Message}"); } return(BadRequest("Failed to edit the contact.")); }