Ejemplo n.º 1
0
        /// <summary>
        ///  关于我们
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult About(int id)
        {
            if (_newService.GetCategory(id) == null)
            {
                throw new Exception("输入的参数有误");
            }

            HomeListModel model = new HomeListModel();

            model.ShowCategoryListModel = ShowCategoryListModel();
            model.CategoryInfo          = _newService.GetCategory(id).ToModel <CategoryModel>();
            model.GetId = id;

            return(View(model));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 新闻中心
        /// Add by zhengsong
        /// Update By xiaofan
        /// </summary>
        /// <returns></returns>
        public ActionResult NewList(int categoryId)
        {
            if (_newService.GetArticleListByCategoryId(categoryId) == null)
            {
                throw new Exception("输入的参数有误");
            }

            NewListModel model = new NewListModel();

            model.ShowCategoryListModel = ShowCategoryListModel();
            //获取当前类别列表信息
            model.CategoryInfo   = _newService.GetCategory(categoryId).ToModel <CategoryModel>();
            model.GetArticleList = _newService.GetArticleListByCategoryId(categoryId).ToModelAsCollection <Article, ArticleModel>();
            model.GetId          = categoryId;


            return(View(model));
        }
Ejemplo n.º 3
0
        public ActionResult NewsEdit(string articleId)
        {
            if (articleId.IsNullOrEmpty())
            {
                return(View());
            }

            var model = _newService.GetArticle(int.Parse(articleId));

            ArticleModel viewModel = null;

            if (model != null)
            {
                viewModel = new ArticleModel();
                model.CopyTo(viewModel);
                var category = _newService.GetCategory(model.CategoryID);
                viewModel.CategoryName = category != null ? category.Name : "";
            }
            return(View(viewModel));
        }