public async Task OnGetAsync(string location) { var birtdays = await m_birthdayQuery.GetBirthdays(location); var now = DateTime.Now; Response = new BirtdayResponse { TodaysBirthdays = birtdays.Where(b => b.Days == 0).ToList() }; Response.NextBirthdays.AddRange(birtdays.Where(b => !Response.TodaysBirthdays.Contains(b)).Take(3)); }
public async Task <BirtdayResponse> Get(string location, int amount = 3) { var birtdays = await m_birthdayQuery.GetBirthdays(location); var now = DateTime.Now; var response = new BirtdayResponse { TodaysBirthdays = birtdays.Where(b => b.Days == 0).ToList() }; if (response.TodaysBirthdays.Count < amount) { response.NextBirthdays.AddRange(birtdays.Where(b => !response.TodaysBirthdays.Contains(b)).Take(amount - response.TodaysBirthdays.Count)); } return(response); }