예제 #1
0
        public async void BreedsGetAllTest()
        {
            await AddBreeds();

            var result = await breedsRepository.GetAllBreeds(true);

            Assert.NotNull(result);
        }
예제 #2
0
        //public async Task<IEnumerable<Breeds>> GetAllBreeds()
        public async Task <IActionResult> GetAllBreeds()
        {
            try
            {
                stopWatch.Restart();
                stopWatch.Start();
                var result = await breedsRepository.GetAllBreeds(true);

                stopWatch.Stop();
                logger.LogInformation((int)LogLevel.Information, $"Encontrados {result.Count} raças;{stopWatch.ElapsedMilliseconds}");
                if (env.IsDevelopment())
                {
                    logger.LogDebug((int)LogLevel.Debug, $"Encontrados {result.Count} raças;{stopWatch.ElapsedMilliseconds}");
                }
                return(Ok(result));
            }
            catch (Exception ex)
            {
                logger.LogError((int)LogLevel.Error, $"Erro ao buscar raças: {ex.Message}");
                return(BadRequest());
            }
        }