Esempio n. 1
0
        public async Task <ComandaDto> ObterPorIdAsync(Guid id)
        {
            var comandoCache = await _serviceCache.ObterAsync <ComandaDto, Guid>(id);

            if (comandoCache != null)
            {
                return(comandoCache);
            }

            var comanda = await _repository.ObterPorIdAsync(id);

            var dto = comanda?.ToDto();

            if (dto != null)
            {
                await _serviceCache.SalvarAsync(dto.Id, dto);
            }
            return(dto);
        }
Esempio n. 2
0
        public async Task <ProdutoDto> ObterPorIdAsync(Guid id)
        {
            var produtoCache = await _serviceCache.ObterAsync <ProdutoDto, Guid>(id);

            if (produtoCache != null)
            {
                return(produtoCache);
            }

            var produto = await _repository.ObterPorIdAsync(id);

            var dto = produto?.ToDto();

            if (dto != null)
            {
                await _serviceCache.SalvarAsync(dto.Id, dto);
            }
            return(dto);
        }
Esempio n. 3
0
        public async Task <UsuarioDto> ObterPorIdAsync(Guid id)
        {
            var usuarioCache = await _serviceCache.ObterAsync <UsuarioDto, Guid>(id);

            if (usuarioCache != null)
            {
                return(usuarioCache);
            }

            var usuario = await _repository.ObterPorIdAsync(id);

            var dto = usuario?.ToDto();

            if (dto != null)
            {
                await _serviceCache.SalvarAsync(dto.Id, dto);
            }
            return(dto);
        }