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)));
        }
Ejemplo n.º 2
0
 public IActionResult getNewsItemsById(int id)
 {
     try {
         return(Ok(_newsItemService.GetNewsItemById(id)));
     } catch (ContentNotFoundException e) {
         return(NotFound(e.Message));
     }
 }
Ejemplo n.º 3
0
 public IActionResult GetNewsItemById(int id)
 {
     return(Ok(_newsItemService.GetNewsItemById(id)));
 }