Beispiel #1
0
 public static async Task SaveAuthStands(AuthStandsEntity data)
 {
     await InsertOrUpdate("stand_auth", new Dictionary <string, object>
     {
         { "characterID", data.CharacterID },
         { "token", data.Token },
         { "personalStands", JsonConvert.SerializeObject(data.PersonalStands) },
         { "corpStands", JsonConvert.SerializeObject(data.CorpStands) },
         { "allianceStands", JsonConvert.SerializeObject(data.AllianceStands) },
     });
 }
Beispiel #2
0
        private async Task RefreshStandings(AuthStandsEntity data, string token)
        {
            var stands = await APIHelper.ESIAPI.GetCharacterContacts(Reason, data.CharacterID, token);

            data.PersonalStands = stands.Data.IsFailed ? data.PersonalStands : stands.Result;
            var rChar = await APIHelper.ESIAPI.GetCharacterData(Reason, data.CharacterID, true);

            if (rChar != null)
            {
                stands = await APIHelper.ESIAPI.GetCorpContacts(Reason, rChar.corporation_id, token);

                data.CorpStands = stands == null || stands.Data.IsFailed ? data.CorpStands : stands.Result;
                if (rChar.alliance_id.HasValue)
                {
                    stands = await APIHelper.ESIAPI.GetAllianceContacts(Reason, rChar.alliance_id.Value, token);

                    data.AllianceStands = stands == null || stands.Data.IsFailed ? data.AllianceStands : stands.Result;
                }
                else
                {
                    data.AllianceStands = new List <JsonClasses.Contact>();
                }
            }
        }