Value<Data.GamePlayerRecord> Data.IGameRecorder.Load(Guid account_id) { var val = new Value<Data.GamePlayerRecord>(); var account = this._Find(account_id); if (account.IsPlayer()) { var recordTask = this._Database.Find<Data.GamePlayerRecord>(r => r.Owner == account_id); recordTask.ContinueWith( task => { if (task.Result.Count > 0) { val.SetValue(task.Result.FirstOrDefault()); } else { var newRecord = new Data.GamePlayerRecord { Id = Guid.NewGuid(), Owner = account_id, }; this._Database.Add(newRecord).Wait(); val.SetValue(newRecord); } }); } else { val.SetValue(null); } return val; }
void Data.IGameRecorder.Save(Data.GamePlayerRecord record) { throw new NotImplementedException(); }