Exemplo n.º 1
0
        public async Task <ActionResult <Alias> > GetById(long id)
        {
            var alias = await _repository.GetById(id);

            if (alias == null)
            {
                return(NotFound());
            }

            return(Ok(alias));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the model with the specified id.
        /// </summary>
        /// <param name="id">The unique id</param>
        /// <returns>The model, or null if it doesn't exist</returns>
        public async Task <Alias> GetByIdAsync(Guid id)
        {
            var model = _cache?.Get <Alias>(id.ToString());

            if (model == null)
            {
                model = await _repo.GetById(id).ConfigureAwait(false);

                OnLoad(model);
            }
            return(model);
        }