/// <summary> /// Deprecated Method for adding a new object to the Projects EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToProjects(Project project) { base.AddObject("Projects", project); }
/// <summary> /// Create a new Project object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="lastChanged">Initial value of the LastChanged property.</param> public static Project CreateProject(global::System.Int32 id, global::System.String name, global::System.Byte[] lastChanged) { Project project = new Project(); project.Id = id; project.Name = name; project.LastChanged = lastChanged; return project; }
public void Insert(ProjectDto item) { using (var ctx = ObjectContextManager<PTrackerEntities>.GetManager("PTrackerEntities")) { var newItem = new Project { Name = item.Name, Description = item.Description, Started = item.Started, Ended = item.Ended }; ctx.ObjectContext.AddToProjects(newItem); ctx.ObjectContext.SaveChanges(); item.Id = newItem.Id; item.LastChanged = newItem.LastChanged; } }