Example #1
0
        public async Task <ActionResult> Get([FromBody] RoteiroFilter item)
        {
            try
            {
                //carrega o repositorio
                using var repository = new RoteiroRepository();

                //efetua a consulta
                var result = await repository.Busca(item);

                //retorna o resultado
                return(Ok(result));
            }
            catch (Exception ex)
            {
                return(BadRequest(new ValidationModel(ex.Message)));
            }
        }
Example #2
0
        public async Task <ActionResult> Get(int id)
        {
            try
            {
                //carrega o repositorio
                using var repository = new RoteiroRepository();

                //efetua a consulta
                var result = await repository.Busca(id);

                //retorna o resultado
                if (result != null)
                {
                    return(Ok(result));
                }

                return(NoContent());
            }
            catch (Exception ex)
            {
                return(BadRequest(new ValidationModel(ex.Message)));
            }
        }