コード例 #1
0
 public IActionResult GetRssFeed()
 {
     return(Content(JsonConvert.SerializeObject(rssFeedService.GetRssFeed(), Formatting.Indented,
                                                new JsonSerializerSettings
     {
         ReferenceLoopHandling = ReferenceLoopHandling.Ignore
     }), "application/json"));
 }
コード例 #2
0
 public IActionResult GetRssFeed()
 {
     try
     {
         var data    = _rssFeedService.GetRssFeed();
         var results = Mapper.Map <IEnumerable <RssFeedDomainObj> >(data);
         return(Ok(results));
     }
     catch (Exception exception)
     {
         _logger.LogCritical($"Exception while getting Rss Feed", exception);
         return(StatusCode(500, "A problem happened while handling your request."));
     }
 }
コード例 #3
0
        public ActionResult <List <ParsedEpisodeInfo> > Get(string url)
        {
            if (string.IsNullOrEmpty(url))
            {
                return(BadRequest());
            }

            try
            {
                return(Ok(_rssFeedService.GetRssFeed(url)));
            }
            catch (InvalidOperationException e)
            {
                return(BadRequest("Invalid element name during parsing"));
            }
        }