Ejemplo n.º 1
0
        public HttpResponseMessage GetNewsByIdAndPermalink(int id, string permalink)
        {
            var article = magazineService.GetNewsByIdAndPermalink(id, permalink);

            if (article == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "No se encontró la noticia."));
            }

            var ads = magazineService.Api_Ads_GetByTags(article.Keywords, article.Category.MagazineId);

            return(Request.CreateResponse(HttpStatusCode.OK, TheModelFactory.Article_Response(article, ads)));
        }
Ejemplo n.º 2
0
        public HttpResponseMessage ViewMagazineNew(string mGuid, int nId)
        {
            var article = magazineService.ApiGetNewById(mGuid, nId);

            if (article == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "No se encontró la noticia."));
            }

            var ads = magazineService.Api_Ads_GetByTags(article.Keywords, article.Category.MagazineId);

            return(Request.CreateResponse(HttpStatusCode.OK, TheModelFactory.Article_Response(article, ads)));
        }
Ejemplo n.º 3
0
        public HttpResponseMessage GetNews(int id)
        {
            var news = magazineService.GetNewsById(id);

            if (news == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "No se encontró la noticia."));
            }

            var ads = magazineService.Api_Ads_GetByTags(news.Keywords, news.Category.MagazineId);

            return(Request.CreateResponse(HttpStatusCode.OK, TheModelFactory.Article_Response(news, ads)));
        }