async Task <IWatchList> IWatchListsClient.GetPredefinedWatchListAsync(string watchListId)
        {
            try
            {
                var data = _readerWatchListCustomNoSql.Get(WatchListPredefinedNoSql.GeneratePartitionKey(), WatchListPredefinedNoSql.GenerateRowKey(watchListId));

                if (data != null)
                {
                    return(data);
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex, $"Cannot read from MyNoSQL. Table: ${WatchListPredefinedNoSql.TableNamePredefinedWatchList}, PK: {WatchListPredefinedNoSql.GeneratePartitionKey()}, RK: {WatchListPredefinedNoSql.GenerateRowKey(watchListId)}", ex);
            }

            try
            {
                var result = await HttpClient.WatchListGetPredefinedAsync(watchListId);

                var data = FromWatchListResponse(result);
                return(data);
            }
            catch (Exception ex)
            {
                _log.Error(ex, $"Cannot read from API. Method: WatchListGetPredefinedAsync, watchListId: {watchListId}");
                throw;
            }
        }
Пример #2
0
        public async Task <IWatchList> AddPredefinedAsync(IWatchList watchList)
        {
            await _predefinedWatchListRepository.UpsertAsync(watchList);

            await _myNoSqlWriterPredefined.TryInsertOrReplaceAsync(WatchListPredefinedNoSql.Create(watchList));


            return(watchList);
        }
Пример #3
0
        public async Task RemovePredefinedAsync(string watchListId)
        {
            await _predefinedWatchListRepository.RemoveAsync(watchListId);

            await _myNoSqlWriterPredefined.TryDeleteAsync(WatchListPredefinedNoSql.GeneratePartitionKey(), WatchListPredefinedNoSql.GenerateRowKey(watchListId));
        }