Exemple #1
0
        public ActionResult Edit(long id)
        {
            GetViewbagNewCategory();
            var model = newRepository.GetNewById(id);

            return(View(model));
        }
Exemple #2
0
        public ActionResult Details(long id)
        {
            var model = newRepository.GetNewById(id);

            if (model != null && model.DanhMucTinTuc.ThuTuHienThi < 1000)
            {
                GetViewBagNewCategory();
                GetViewBagRecentNew();
                GetViewBagRelateNew(model.NewCategoryID);
                model.LuotXem += 1;
                newRepository.SaveNew(model);
                return(View(model));
            }
            if (model != null && model.DanhMucTinTuc.ThuTuHienThi >= 1000)
            {
                GetViewBagNewCategory(2);
                GetViewBagRecentNew(2);
                GetViewBagRelateNew(model.NewCategoryID, 2);
                model.LuotXem += 1;
                newRepository.SaveNew(model);
                return(View(model));
            }
            else
            {
                return(View());
            }
        }
Exemple #3
0
 //修改
 //通过Index()中遍历得到的Id获取当前选择的新闻的详情
 public IActionResult Update(int id)//修改视图update.cshtml
 {
     return(View(_newRepository.GetNewById(id)));
 }
Exemple #4
0
 public ViewResult ConfirmDelete(long id)
 {
     var model =newRepository.GetNewById(id);
     return View(model);
 }
 //获取详情页面
 public IActionResult Detail(int id)
 {
     return(View(_newRepository.GetNewById(id)));
 }