public async Task DeleteCharacter(Raid raid, Encounter encounter, EncounterCharacter character) { Console.WriteLine("EncounterService::DeleteCharacter"); var jsonToPost = JsonConvert.SerializeObject(character); var path = $"rest/raids/{raid.Id}/encounters/{encounter.Id}/characters/{character.CharacterId}"; Console.WriteLine($"DELETEing to {path}"); var result = await httpClient.DeleteAsync(path); result.EnsureSuccessStatusCode(); }
public void Add(Player player, Character character, Role role) { if (!Raid.Finalized) { Console.WriteLine($"Adding {player.Name} as {role}"); var encounterCharacter = new EncounterCharacter { PlayerId = (int)player.Id, CharacterId = (int)character.Id, Role = role }; EncounterService.AddCharacter(Raid, Encounter, encounterCharacter); Encounter.Characters.Add(encounterCharacter); } }
public async Task AddCharacter(Raid raid, Encounter encounter, EncounterCharacter character) { Console.WriteLine("EncounterService::AddCharacter"); var jsonToPost = JsonConvert.SerializeObject(character); var path = $"rest/raids/{raid.Id}/encounters/{encounter.Id}/characters"; Console.WriteLine($"POSTing to {path}"); var result = await httpClient.PostAsync(path, new StringContent(jsonToPost, Encoding.UTF8, "application/json")); result.EnsureSuccessStatusCode(); }