コード例 #1
0
        public bool UpdateProject(Project project)
        {
            Project dataProject = entities.Projects.SingleOrDefault(p => p.ProjectID == project.ProjectID);
            if (dataProject != null)
            {
                dataProject.Title = project.Title;
                dataProject.Description = project.Description;
                dataProject.Budget = project.Budget;

                int updated = entities.SaveChanges();
                return (updated > 0);
            }
            return false;
        }
コード例 #2
0
 public int CreateProject(Project project)
 {
     entities.Projects.Add(project);
     int newID = entities.SaveChanges();
     return newID;
 }