public IActionResult Delete(int ProjectID)
        {
            ProjectDAO dao = new ProjectDAO();

            dao.Delete(ProjectID);
            return(RedirectToAction("Index"));
        }
        private void button3_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();
            try
            {
                ProjectDAO projectDAO = new ProjectDAO();
                bool       res        = projectDAO.Delete(projectId);

                if (res)
                {
                    listView1.Items.Clear();
                    GetAllProject();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 3
0
        private void ButtonDeleteProject_Click(object sender, RoutedEventArgs e)
        {
            foreach (UIElement element in projectList.Children)
            {
                if (element.Uid.Equals(project.Id.ToString()))
                {
                    projectList.Children.Remove(element);
                    break;
                }
            }

            if (mainController.Project.Id.Equals(project.Id))
            {
                if (projectDAO.Delete(project.Id))
                {
                    List <Project> projects = mainController.UserProjects();

                    if (projects.Count > 0)
                    {
                        mainController.Project = projects[0];
                    }
                    else
                    {
                        mainController.Project = null;
                    }

                    mainController.ChangeProject();

                    foreach (UIElement element in projectList.Children)
                    {
                        if (element.Uid.Equals(project.Id.ToString()))
                        {
                            projectList.Children.Remove(element);
                            break;
                        }
                    }
                    Close();
                }
            }
        }