public void OnProjectSelected(SelectedProjectArgs args)
 {
     Projects.ForEach(project =>
                          {
                              if (project.Id == args.ProjectId)
                              {
                                  if (SelectedProject != project)
                                  {
                                      SelectedProject = project;
                                      RaisePropertyChanged(() => SelectedProject);
                                  }
                                  return;
                              }
                          });
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Projects EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; 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="title">Initial value of the Title property.</param>
 /// <param name="createdBy">Initial value of the CreatedBy property.</param>
 /// <param name="status">Initial value of the Status property.</param>
 public static Project CreateProject(global::System.Int32 id, global::System.String title, global::System.Guid createdBy, global::System.Int32 status)
 {
     Project project = new Project();
     project.Id = id;
     project.Title = title;
     project.CreatedBy = createdBy;
     project.Status = status;
     return project;
 }
 public void ViewProjectExecute(Project project)
 {
     Messanger.Get<ProjectSelectionMessage>().Publish(new SelectedProjectArgs
     {
         ProjectId = project.Id,
         ProjectTitle = project.Title
     });
     var regionManager = _container.Resolve<RegionManager>();
     regionManager.RequestNavigate("MainRegion", new Uri("ProjectIssuesView", UriKind.Relative));
 }
        public void EditProjectExecute(Project project)
        {
            var window =
                _container.Resolve<IModalWindow>("editprojectwindow");
            var viewModel =
                _container.Resolve<EditProjectViewModel>();
            viewModel.CurrentProject = project;
            _modalDialogService.ShowDialog(window, viewModel,
                returnedViewModelInstance =>
                {
                    if (!window.DialogResult.HasValue ||
                        !window.DialogResult.Value) return;

                    var index = Projects.IndexOf(project);
                    Projects[index] = returnedViewModelInstance.CurrentProject;
            //                    _context.Projects.Detach(project);
                    _context.SubmitChanges();
                    LoadData();
                });
        }
        public void DeleteProjectExecute(Project project)
        {
            var result =
                _messageBoxService.Show(string.Format("Are you sure you want to delete project '{0}'?", project.Title),
                                        "Deleting object", GenericMessageBoxButton.OkCancel);
            if (result == GenericMessageBoxResult.Cancel) return;

            _context.Projects.Remove(project);
            _context.SubmitChanges();
            LoadData();
        }