public ActionResult Edit(NewsItem news, string view, string resultView) { if (ModelState.IsValid == false) { return PartialView(view, news); } newsRep.Edit(news); return PartialView(resultView, news); }
public ActionResult Create(NewsItem news) { if (ModelState.IsValid == false) { return RedirectToCurrentUmbracoPage(); } news.PublishedTime = DateTime.Now; newsRep.Add(news, CurrentPage.Id); return RedirectToCurrentUmbracoPage(); }
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); }
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); }