コード例 #1
0
ファイル: SQLiteClient.cs プロジェクト: RobGibbens/CodeStock
        public async Task Save(Conference conference)
        {
            using (await Mutex.LockAsync().ConfigureAwait(false))
            {
                // Because our conference model is being mapped from the dto,
                // we need to check the database by name, not id
                var existingConference = await _connection.Table<Conference>()
                        .Where(x => x.Slug == conference.Slug)
                        .FirstOrDefaultAsync();

                if (existingConference == null)
                {
                    await _connection.InsertAsync(conference).ConfigureAwait(false);
                }
                else
                {
                    conference.Id = existingConference.Id;
                    await _connection.UpdateAsync(conference).ConfigureAwait(false);
                }

                if (conference.Sessions != null && conference.Sessions.Any())
                {
                    await SaveAllSessions(conference.Slug, conference.Sessions);
                }
            }
        }
コード例 #2
0
ファイル: 42.cs プロジェクト: RobGibbens/CodeStock
 public async void Init(string slug)
 {
     _conference = await _sqliteClient.GetConference(slug).ConfigureAwait(false);
     this.Sessions = _conference.Sessions;
 }