public ProjectDetailsViewModel(Project project, MainWindowViewModel mainWindow) { _project = project; _mainWindow = mainWindow; SetTabTitle(); }
/// <summary> /// Saves a project to the database, either by updating an existing one or inserting a new one. /// </summary> /// <param name="project">The project to be saved.</param> /// <returns>If the return value is true then a new project has been added. /// If it's false then an existing project has been modified.</returns> public bool Save(Project project) { bool newProject = false; Project projectToSave = GetForKeyTable(project.KeyTable); if (projectToSave == null) { projectToSave = new Project(); _dataContext.Projects.InsertOnSubmit(projectToSave); newProject = true; } projectToSave.Description = project.Description; projectToSave.Name = project.Name; _dataContext.SubmitChanges(); //little bit friggy but need access to the keyTable that we've just assigned. project.KeyTable = projectToSave.KeyTable; return newProject; }
public SaveProjectCommand(Project project, ProjectDetailsViewModel projectDetails, MainWindowViewModel mainWindow) { _project = project; _projectDetails = projectDetails; _mainWindow = mainWindow; }
public List<Task> GetForProject(Project project) { IQueryable<Task> tasks = GetAllTasks(); return tasks.Where(t => t.Project == project && !t.Done).ToList(); }
partial void DeleteProject(Project instance);
partial void UpdateProject(Project instance);
partial void InsertProject(Project instance);
public void DeleteProject(Project project) { Project existingProject = GetForKeyTable(project.KeyTable); _dataContext.Projects.DeleteOnSubmit(existingProject); _dataContext.SubmitChanges(); }
public bool ContainsProject(Project project) { return GetForKeyTable(project.KeyTable) != null; }