Ejemplo n.º 1
0
        public async Task RunExternalDBTest2()
        {
            ExternalDBService dbService = new ExternalDBService();

            IEMember member = new IEMember();

            member.ProfileId = "8888888";
            member.Username  = "******";
            member.EyeColour = "Blue";

            IEMember reply = await dbService.AddNewMember("kiss me slowly", member);

            Console.WriteLine("Reply Found " + reply);
        }
Ejemplo n.º 2
0
        public async void SaveMember(IEMember member)
        {
            _logger.LogInfo("Saving member " + member.Id + " profile=" + member.Username + " Status=" + member.Status);

            if (member.Id == 0)
            {
                IEMember newMember = await _externalDb.AddNewMember(Settings.UserName, member);

                if (newMember != null)
                {
                    member.Id = newMember.Id;
                    Members.Add(member.ProfileId, member);
                }
            }
            else
            {
                IEMember newMember = await _externalDb.ModifyMember(Settings.UserName, member);

                if (Members.TryGetValue(member.ProfileId, out IEMember prevMember))
                {
                    Members.Remove(member.ProfileId);
                }
                Members.Add(member.ProfileId, member);
            }

            /*
             * if ( member.Id == 0 )
             * {
             *  _database.InsertAsync(member).Wait();
             *  Members.Add(member.ProfileId, member);
             * }
             * else
             * {
             *  _database.UpdateAsync(member).Wait();
             *  if ( Members.TryGetValue(member.ProfileId, out IEMember prevMember)) {
             *      Members.Remove(member.ProfileId);
             *  }
             *  Members.Add(member.ProfileId, member);
             * }
             */
        }