Пример #1
0
        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 });
        }
Пример #2
0
        public ActionResult NewsAdd(News model,FormCollection f)
        {
            int parentID = Request.QueryString["parentID"] == null ? 0 : int.Parse(Request.QueryString["parentID"].ToString());
            int typeID = Request.QueryString["typeID"] == null ? 0 : int.Parse(Request.QueryString["typeID"].ToString());
            int bbsMainID = Request.QueryString["bbsMainID"] == null ? 0 : int.Parse(Request.QueryString["bbsMainID"].ToString());
            bizNewsType bt = new bizNewsType();
            bizNews b = new bizNews();
            bizNewsContent bc = new bizNewsContent();
            NewsContent modelContent = new NewsContent();

            modelContent.Content = f["Content"];

            model.AddIP = Public.CommonHelper.GetIPAddress();
            int newsID=b.Add(model);
            modelContent.PageID = 1;
            modelContent.NewsID = newsID;
            bc.Add(modelContent);
            return RedirectToAction("NewsMod", new { id = newsID });
        }