Beispiel #1
0
 public IHttpActionResult SaveNewsSettigs(string userId, NewsSettings ns)
 {
     try
     {
         NewsCrud.SaveSettings(userId, ns);
         return(StatusCode(HttpStatusCode.Accepted));
     }
     catch (Exception e)
     {
         logger.Error(e.Message);
         return(InternalServerError());
     }
 }
Beispiel #2
0
 public IHttpActionResult GetArticles(string userId)
 {
     try
     {
         NewsSettings settings = NewsCrud.ReadSettings(userId);
         NewsApiClient client = new NewsApiClient(settings);
         IEnumerable<NewsArticle> articles = client.GetNewsArticles(1);
         return Ok(articles);
     }
     catch (Exception e)
     {
         logger.Error(e.Message);
         return InternalServerError();
     }
 }