public ActionResult Update(Guid id, string content, string title) { var item = _ctx.DContents.FirstOrDefault(x => x.Id == id); if (item != null) { item.Content = content; _ctx.DContents.ApplyCurrentValues(item); _ctx.SaveChanges(); } else { var page = new DContent { Content = content, Title = title, CategoryId = Categories.About, Created = DateTime.UtcNow, Updated = DateTime.UtcNow }; _ctx.DContents.AddObject(page); _ctx.SaveChanges(); } return RedirectToAction("About", "Management"); }
/// <summary> /// Deprecated Method for adding a new object to the DContents EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToDContents(DContent dContent) { base.AddObject("DContents", dContent); }
/// <summary> /// Create a new DContent object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="typeId">Initial value of the TypeId property.</param> /// <param name="route">Initial value of the Route property.</param> /// <param name="position">Initial value of the Position property.</param> /// <param name="browserTitle">Initial value of the BrowserTitle property.</param> /// <param name="metaDescription">Initial value of the MetaDescription property.</param> /// <param name="metaKeywords">Initial value of the MetaKeywords property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="title">Initial value of the Title property.</param> /// <param name="announce">Initial value of the Announce property.</param> /// <param name="content">Initial value of the Content property.</param> /// <param name="created">Initial value of the Created property.</param> /// <param name="updated">Initial value of the Updated property.</param> /// <param name="publishDate">Initial value of the PublishDate property.</param> /// <param name="expirationDate">Initial value of the ExpirationDate property.</param> /// <param name="isPublished">Initial value of the IsPublished property.</param> public static DContent CreateDContent(global::System.Guid id, global::System.String typeId, global::System.String route, global::System.Int32 position, global::System.String browserTitle, global::System.String metaDescription, global::System.String metaKeywords, global::System.String name, global::System.String title, global::System.String announce, global::System.String content, global::System.DateTime created, global::System.DateTime updated, global::System.DateTime publishDate, global::System.DateTime expirationDate, global::System.Boolean isPublished) { DContent dContent = new DContent(); dContent.Id = id; dContent.TypeId = typeId; dContent.Route = route; dContent.Position = position; dContent.BrowserTitle = browserTitle; dContent.MetaDescription = metaDescription; dContent.MetaKeywords = metaKeywords; dContent.Name = name; dContent.Title = title; dContent.Announce = announce; dContent.Content = content; dContent.Created = created; dContent.Updated = updated; dContent.PublishDate = publishDate; dContent.ExpirationDate = expirationDate; dContent.IsPublished = isPublished; return dContent; }