예제 #1
0
 public IActionResult Get()
 {
     try
     {
         var fives = _repository.GetAll();
         if (fives == null)
         {
             return(NotFound($"아무런 데이터가 없습니다."));
         }
         return(Ok(fives)); // 200
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
 public IActionResult Get()
 {
     try
     {
         IEnumerable <FiveViewModel> fives = _repository.GetAll();
         if (fives == null)
         {
             return(NotFound($"아무런 데이터가 없습니다."));
         }
         return(Ok(fives));
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
예제 #3
0
        public IActionResult Get()
        {
            // 500 에러 찍어보려면,
            // throw new Exception("인위적으로 에러 발생시켜 500에러 출력");

            try
            {
                var fives = _repository.GetAll();
                if (fives == null)
                {
                    return(NotFound($"아무런 데이터가 없습니다."));
                }
                return(Ok(fives)); // 200
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }