Example #1
0
        public async Task <IEnumerable <Sample> > GetAll()
        {
            if (cachingService.Exists(CacheKey.Samples))
            {
                return(cachingService.Get <IEnumerable <Sample> >(CacheKey.Samples));
            }

            var list = await repository.GetAllAsync(x => x.StatusId != StatusType.Deleted.ToInt32());

            AddItemsToCache(list);

            return(list);
        }
Example #2
0
        public async Task <AccountEvolutionModel> GetAccountEvolution(int accountId)
        {
            if (cachingService.Exists($"{nameof(GetAccountEvolution)}{accountId}"))
            {
                return(cachingService.Get <AccountEvolutionModel>($"{nameof(GetAccountEvolution)}{accountId}"));
            }

            var result = await accountMetricsServiceClient.GetAccountEvolution(accountId);

            cachingService.StoreOrUpdate($"{nameof(GetAccountEvolution)}{accountId}", result);

            return(result);
        }
Example #3
0
 public async Task Logout()
 {
     isAuthenticated = false;
     OnAuthenticationChanged?.Invoke(this, EventArgs.Empty);
     //await authServiceClient.Logout();
     if (cachingService.Exists("user"))
     {
         cachingService.Remove("user");
     }
 }
Example #4
0
        public async Task <IEnumerable <NotificationModel> > GetNotifications()
        {
            if (cachingService.Exists(nameof(NotificationManager.GetNotifications)))
            {
                return(cachingService.Get <IEnumerable <NotificationModel> >(nameof(NotificationManager.GetNotifications)));
            }

            var notifications = await notificationServiceClient.GetNotifications();

            cachingService.Store(nameof(NotificationManager.GetNotifications), notifications);

            return(notifications);
        }
Example #5
0
        public async Task <IEnumerable <Transaction> > GetAutoComplete()
        {
            if (cachingService.Exists(nameof(GetAutoComplete)))
            {
                return(cachingService.Get <IEnumerable <Transaction> >(nameof(GetAutoComplete)));
            }

            var results = await transactionServiceClient.GetAutoComplete();

            var transactions = MapToEntities(results);

            cachingService.Store(nameof(GetAutoComplete), transactions);

            return(transactions);
        }