// If success, return generated CharacterId public static async Task <int> CreateCharacter(ICharacter character, int userId) { Webservice webservice = new Webservice(BASE_URL); String methodRoute = "/"; JObject jObject = new JObject(); if (character is Warrior) { jObject = await webservice.HttpClientSenderJObject(CHARACTER_URL + methodRoute + userId, character as Warrior); } else if (character is Hunter) { jObject = await webservice.HttpClientSenderJObject(CHARACTER_URL + methodRoute + userId, character as Hunter); } else if (character is Magus) { jObject = await webservice.HttpClientSenderJObject(CHARACTER_URL + methodRoute + userId, character as Magus); } JToken value = jObject.First; return(value.ToObject <int>()); }
// If success, return generated GearId public static async Task <int> CreateGear(Gear gear, int gearBaseId) { Webservice webservice = new Webservice(BASE_URL); String methodRoute = "/"; JObject jObject = new JObject(); jObject = await webservice.HttpClientSenderJObject(GEAR_URL + methodRoute + gearBaseId, gear); JToken value = jObject.First; int result = value.ToObject <int>(); return(result); }
// If success, return generated UsableId public static async Task <int> CreateUsable(Stats stats, int usableBaseId) { Webservice webservice = new Webservice(BASE_URL); String methodRoute = "/"; JObject jObject = new JObject(); jObject = await webservice.HttpClientSenderJObject(USABLE_URL + methodRoute + usableBaseId, stats); JToken value = jObject.First; int result = value.ToObject <int>(); return(result); }