예제 #1
0
        public tbl_personal_project AddPersonalProject()
        {
            tbl_personal_project project = new tbl_personal_project
            {
                title        = projTitle,
                projectDesc  = projectDesc,
                ownerId      = ownerId,
                privacy      = privacy,
                isWorkerProj = isWorkerProj ? 1 : 0,
                created      = created,
                completed    = completed
            };

            db.tbl_personal_project.Add(project);
            db.SaveChanges();
            return(project);
        }
예제 #2
0
        public List <string> RemoveProject()
        {
            tbl_personal_project project = db.tbl_personal_project.Find(perprojectId);

            db.Entry(project).State = System.Data.Entity.EntityState.Deleted;
            IEnumerable <tbl_pproject_skill> projSkills = db.tbl_pproject_skill.Where(w => w.perprojectId == perprojectId).ToList();

            db.tbl_pproject_skill.RemoveRange(projSkills);

            List <string> path = new List <string>();
            IEnumerable <tbl_proj_screenshots> screenShots = db.tbl_proj_screenshots
                                                             .Where(w => w.projectId == perprojectId).ToList();

            if (screenShots?.Count() > 0)
            {
                foreach (tbl_proj_screenshots projSkill in screenShots)
                {
                    path.Add(projSkill.path);
                }
                db.tbl_proj_screenshots.RemoveRange(screenShots);
            }
            db.SaveChanges();
            return(path);
        }