private void OnDeleteCharacterCallback(RequestException request, ResponseHelper response) { var statusCode = response.StatusCode; var json = response.Text; DeleteCharacterCallback?.Invoke(statusCode, json); }
public void DeleteCharacter(int characterid) { var item = default(CharacterData); var itemExists = false; foreach (var characterData in characters) { if (characterData.id == characterid) { item = characterData; itemExists = true; } } var statusCode = 0; var json = string.Empty; if (itemExists) { characters.Remove(item); statusCode = 200; DeleteCharacterCallback?.Invoke(statusCode, json); } else { statusCode = 404; json = "The character was not found."; DeleteCharacterCallback?.Invoke(statusCode, json); } }