public async Task<ActionResult<IEnumerable<CompanyModel>>> GetCompanies(CancellationToken cancellationToken) { var data = await _repository.GetStaticDataAsync(cancellationToken); var list = data.Companies .OrderBy(x => x.Value.Description) .Select(x => new CompanyModel { Id = x.Key, Description = x.Value.Description, Name = x.Value.Name }); return Ok(new SuccessResponse<IEnumerable<CompanyModel>>(list)); }
public async Task <StaticDataStore> GetStaticDataAsync(CancellationToken token) { Func <Task <StaticDataStore> > actionToCache = () => _repository.GetStaticDataAsync(token); var cachedData = await _cache.GetOrAddAsync("StaticData", actionToCache); return(cachedData); }
public CreateMasterTradingAgreementCommandHandler(AppDbContext db, IStaticDataRepository repository) { _db = db; _staticData = repository.GetStaticDataAsync().Result; }