private async Task SyncCommandsWithServer() { await SyncCommandLogs(); var notSyncedCommands = await _commandRepository.GetAllNotSynced(); if (notSyncedCommands.Any()) { var response = HttpClientHelper.Post <IEnumerable <String> >($"{_suncBaseUrl}{Endpoints.Command.Execute}", null); if (response != null && response.Any()) { MongoDBHelper.RunCommands(_commandRepository, notSyncedCommands.Where(w => response.Contains(w.Guid)).ToList()); } } Console.WriteLine($"{DateTime.Now.ToString("s")} commands synced."); }
public async Task <ActionResult> SyncCommands() { return(Ok((await _commandRepository.GetAllNotSynced()).Select(_mapper.Map <CommandViewModel>))); }