Ejemplo n.º 1
0
        public virtual async Task <IActionResult> GetEntityByNameAsync([FromRoute] string name)
        {
            try
            {
                var entity = await entitiesRepository.GetByIdAsync(name);

                if (entity == null)
                {
                    return(NotFound($"No data found for entity {name}"));
                }

                return(Ok(entity));
            }
            catch (Exception e)
            {
                return(this.InternalServerError(e.FlattenMessages()));
            }
        }
Ejemplo n.º 2
0
        public virtual async Task <IActionResult> Get([FromRoute] string name)
        {
            var entity = await entitiesRepository.GetByIdAsync(name);

            if (entity == null)
            {
                return(NotFound($"No data found for entity {name}"));
            }

            return(Ok(entity));
        }