コード例 #1
0
 public ActionResult Edit(NewsItem news, string view, string resultView)
 {
     if (ModelState.IsValid == false)
     {
         return PartialView(view, news);
     }
     newsRep.Edit(news);
     return PartialView(resultView, news);
 }
コード例 #2
0
        public ActionResult Create(NewsItem news)
        {
            if (ModelState.IsValid == false)
            {
                return RedirectToCurrentUmbracoPage();
            }

            news.PublishedTime = DateTime.Now;
            newsRep.Add(news, CurrentPage.Id);
            return RedirectToCurrentUmbracoPage();
        }
コード例 #3
0
        public void Edit(NewsItem news)
        {
            var content = _service.GetById(news.Id);

            content.Name = news.Title;

            content.SetValue("Content", news.Text);
            content.SetValue("Title", news.Title);
            content.SetValue("Author", news.Author);

            _service.SaveAndPublish(content);
        }
コード例 #4
0
        public void Add(NewsItem news, int parentId)
        {
            var content = _service.CreateContent(news.Title, parentId, _type);

            content.Name = news.Title;

            content.SetValue("Content", news.Text);
            content.SetValue("Title", news.Title);
            content.SetValue("Author", news.Author);
            content.SetValue("PublishedTime", news.PublishedTime);
            _service.SaveAndPublish(content);
        }