public IActionResult GetNewsItemById(int id)
        {
            //TODO: What if there is no item with this id ?

            var newsItem = _newsItemService.GetNewsItemById(id);

            if (newsItem == null)
            {
                return(BadRequest("No news item with this Id exists."));
            }
            return(Ok(_newsItemService.GetNewsItemById(id)));
        }
Пример #2
0
 public IActionResult getNewsItemsById(int id)
 {
     try {
         return(Ok(_newsItemService.GetNewsItemById(id)));
     } catch (ContentNotFoundException e) {
         return(NotFound(e.Message));
     }
 }
Пример #3
0
 public IActionResult GetNewsItemById(int id)
 {
     return(Ok(_newsItemService.GetNewsItemById(id)));
 }