Beispiel #1
0
        public ActionResult Show(string id)
        {
            this.Internationalization();

            NewsModel model = new NewsModel();

            if (string.IsNullOrEmpty(id))
            {
                id = "1";
            }

            NewsService newsService = new NewsService();
            model.News = newsService.GetNewsById(Int32.Parse(id));

            if (model.News == null)
            {
                model.News = new Model.News();
                model.News.Title = "该新闻不存在或已被删除";
            }
            else
            {
                AlbumService albumService = new AlbumService();
                int outCount = 0;
                model.RelatedAlbum = albumService.GetAlbumList(string.Empty, model.News.Keywords, 5, 1, out outCount);
                model.RelatedNews = newsService.GetRelatedNews(model.News.Id);
                model.LastNews = newsService.GetPrvNewsById(model.News.Id);
                model.NextNews = newsService.GetNextNewsById(model.News.Id);
            }

            return View(model);
        }