public async Task <IHttpActionResult> Get() { var entries = await _subReddits.GetAllAsync(); return(Ok(from e in entries orderby e.Name select new { name = e.Name, status = "Linked" })); }
public async Task <IHttpActionResult> Get() { var items = await _subReddits.GetAllAsync(); return(Ok(from i in items orderby i.Name select new { name = i.Name, status = "Connected" })); }
private async Task ExecuteInternal() { while (true) { var users = await _flairs.GetUsersForUpdateAsync(MaxUsersPerLoop); var subReddits = await _subReddits.GetAllAsync(); if (!users.Any()) { await Task.Delay(NoUsersWaitInterval); continue; } var flairParams = new List <UserFlairParameter>(); foreach (var user in users) { flairParams.Add(new UserFlairParameter { Name = user.Name, Text = await GetFlairTextAsync(user) }); } foreach (var sub in subReddits) { if (!await _reddit.SetUserFlairsAsync(sub.Name, flairParams)) { throw new InvalidOperationException($"Update flair failed on /r/{sub.Name}."); } } if (!await _flairs.SetUpdatedAsync(users)) { throw new InvalidOperationException("Unable to clear flair update flag."); } await Task.Delay(1); } }