Пример #1
0
        public async Task <IActionResult> GetAll()
        {
            try
            {
                var notices = await _repository.GetAllAsync();

                return(Ok(notices));
            }
            catch (Exception e)
            {
                _logger.LogError(e.Message);
                return(BadRequest());
            }
        }
Пример #2
0
        public async Task <IActionResult> GetAll()
        {
            try
            {
                var models = await _repository.GetAllAsync();

                if (!models.Any())
                {
                    return(new NoContentResult()); // 참고용 코드
                }
                return(Ok(models));
            }
            catch (Exception e)
            {
                _logger.LogError(e.Message);
                return(BadRequest());
            }
        }