//Delete the Project on the basis of the projectID public static List<Project> DeleteProject(Project p) { var proj = (from project in dataContext.Projects where project.ProjectID == p.ProjectID select project).SingleOrDefault(); dataContext.Projects.Remove(proj); dataContext.SaveChanges(); return GetAllProjects(); }
//Update the Project on the basis of the projectID public static List<Project> UpdateProject(Project p) { //get the details of the project var proj = (from project in dataContext.Projects where project.ProjectID == p.ProjectID select project).SingleOrDefault(); proj.ProjectName = p.ProjectName; proj.StartDate = p.StartDate; proj.EndDate = p.EndDate; proj.ClientName = p.ClientName; dataContext.SaveChanges(); return GetAllProjects(); }
//Insert Project public static List<Project> InsertProject(Project p) { dataContext.Projects.Add(p); dataContext.SaveChanges(); return GetAllProjects(); }