public async Task <GetBadgesResponse> Get() { var response = new GetBadgesResponse { Badges = await Task.FromResult(Badges.BadgeList), }; if (MemoryCacher.GetValue(Cache.BadgeRanking) is IEnumerable <BadgeRanking> cacheBadgeRankings) { response.BadgeRankings = cacheBadgeRankings; } else { var badgeRankings = await _databaseRepository.GetBadgeRanking(); if (badgeRankings != null) { MemoryCacher.Add(Cache.BadgeRanking, badgeRankings, DateTimeOffset.UtcNow.AddDays(1)); } response.BadgeRankings = badgeRankings; } return(response); }
public async Task <GetBadgesResponse> GetBadges(GetBadgesRequest request) { var result = new GetBadgesResponse { Data = await this.badgesRepository.GetBadges() }; return(result); }
public static GetBadgesWebResponse AsWebResponse(this GetBadgesResponse response) { var result = new GetBadgesWebResponse { Errors = response.Errors, IsSuccessful = response.IsSuccessful, Message = response.Message, StatusCode = response.StatusCode, Data = response.Data }; return(result); }