public ActionResult Content(int id, int page) { int count; bizNewsType bnt = new bizNewsType(); bizNews bn = new bizNews(); bizNewsContent bnn = new bizNewsContent(); News model = bn.Get(id); NewsContent modelContent = bnn.Get(id, page); NewsType modelType = bnt.Get(model.NewsTypeID); NewsType modelTypeParent = bnt.Get(modelType.ParentID); count = bnn.ListByNewsID(id).Count; model.Attach(); model.HitNum = model.HitNum + 1; model.Detach(); bn.Update(model); ViewData["Bar"] = MenuBar.Start() .AddMenu("��ҳ", "/") .AddMenu("���⾭", "/syj/index.html") .AddMenu(modelTypeParent.TypeName, "/syj/index.html") .AddMenu(modelType.TypeName, "/syj/list/" + modelType.NewsTypeID + "_1.html") .AddMenu(model.Title, "/syj/content/" + model.NewsID + "_1.html") .GetMenuHtml(); ViewData["Content"] = modelContent; ViewData["PageList"] = Page.GetPageList("/syj/content/" + model.NewsID + "_$page$.html", count, 1, page); return View(model); }
public ActionResult NewsMod(int id, News modelOld, FormCollection f) { bizNewsContent bc = new bizNewsContent(); bizNews b = new bizNews(); bizNewsType bt = new bizNewsType(); News model = b.Get(id); NewsContent bContent = bc.Get( id,1); model.Attach(); model.Title = modelOld.Title; model.TitleShort = modelOld.TitleShort; model.TitleColor = modelOld.TitleColor; model.IsBold = modelOld.IsBold; model.NewsTypeID = modelOld.NewsTypeID; model.NewsRemark = modelOld.NewsRemark; model.Images = modelOld.Images; model.PushType = modelOld.PushType; model.Status = modelOld.Status; model.Keyword = modelOld.Keyword; model.NewsSource = modelOld.NewsSource; model.Detach(); bContent.Attach(); bContent.Content = f["Content"]; bContent.Detach(); b.Update(model); bc.Update(bContent); return RedirectToAction("NewsMod", new { id = id }); }