public void Save(NewsBlock newsBlock) { _entitiesSource.NewsBlocks.Attach(newsBlock); _entitiesSource.ObjectStateManager.ChangeObjectState(newsBlock, EntityState.Modified); newsBlock.Posted = DateTime.Now; _entitiesSource.SaveChanges(); }
public static NewsBlock CreateNewsBlock(string title, List <NewsContent> newsContents = null) { var newsBlock = new NewsBlock(title); newsBlock.Set(NewsBlock.PropertyAccessExpressions.NewsContents, newsContents); return(newsBlock); }
public static NewsBlock CreateNewsBlock(string title, params string[] details) { var newsContents = details.Select((detail, i) => CreateNewsContent(i + 1, detail)).ToList(); var newsBlock = new NewsBlock(title); newsBlock.Set(NewsBlock.PropertyAccessExpressions.NewsContents, newsContents); return(newsBlock); }
public ActionResult GetNewsStory() { var vm = new NewsBlock { Header = "From Server at " + DateTime.Now, Ptags = new List <string> { "hello", "world" } }; return(PartialView("_newBlock", vm)); }
public void Create(NewsBlock newsItem) { var locals = Languages; newsItem.Posted = DateTime.Now; _entitiesSource.NewsBlocks.AddObject(newsItem); foreach (var local in locals) { newsItem.NewsBlockLocals.Add(new NewsBlockLocal { NewsBlock = newsItem, LangId = local.Id, Name = "News block new", Summary = "short summary", Body = String.Empty }); } _entitiesSource.SaveChanges(); }
public void Save(NewsBlock newsBlock) { _repository.Save(newsBlock); }
public void Save(NewsBlock newsBlock) { _context.NewsBlocks.Add(newsBlock); _context.SaveChanges(); }