Beispiel #1
0
        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);
                }
            }
        }
Beispiel #2
0
 public async void Init(string slug)
 {
     _conference = await _sqliteClient.GetConference(slug).ConfigureAwait(false);
     this.Sessions = _conference.Sessions;
 }