public async Task <bool> PublishNew() { //get workouts from sheets var ws = new SheetService(); var workouts = (await ws.GetWorkouts()).EmptyIfNull().Where(wo => wo.Show == true); //get social calendars from sheets var socialCalendarIds = await ws.GetSocialCalendars(); var extraCalendars = Mapper.Map <List <CalenderViewModel> >((await GetCalendarList()).Items); //factor out the all but social calendars var socialCalendars = extraCalendars.Where(cal => socialCalendarIds.EmptyIfNull().Select(s => s.CalendarID).Contains(cal.Id)); var retVal = new List <CalenderViewModel>(); retVal.AddRange(Mapper.Map <List <CalenderViewModel> >(workouts)); retVal.AddRange(socialCalendars); var x = await retVal.ForkJoin(async cal => await GetThisWeekEventViewModels(cal)); //todo: get items. //publish to firebase var fbSvc = new FirebaseService(); await fbSvc.Publish(retVal, retVal.SelectMany(cal => cal.Items)); return(retVal != null && retVal.Count > 0); }
public async Task TestRetrive() { var wb = new SheetService(); var list = wb.GetWorkouts(); }