public ActionResult Edit(long id) { GetViewbagNewCategory(); var model = newRepository.GetNewById(id); return(View(model)); }
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()); } }
//修改 //通过Index()中遍历得到的Id获取当前选择的新闻的详情 public IActionResult Update(int id)//修改视图update.cshtml { return(View(_newRepository.GetNewById(id))); }
public ViewResult ConfirmDelete(long id) { var model =newRepository.GetNewById(id); return View(model); }
//获取详情页面 public IActionResult Detail(int id) { return(View(_newRepository.GetNewById(id))); }