Beispiel #1
0
        public Bug Update(Bug bug)
        {
            bug.LastModified = DateTime.Now;

            using (var ctx = new WcfEntityContext())
            {
                var oldBug = ctx.Bugs.Include("CreatedBy").Include("Project").Include("AssignedUser")
                             .Where(h => h.Id == bug.Id).SingleOrDefault();

                var userCreated     = ctx.Users.Where(n => n.Id == bug.CreatedBy.Id).SingleOrDefault();
                var assignedProject = ctx.Projects.Where(c => c.Id == bug.Project.Id).SingleOrDefault();

                if (bug.AssignedUser != null)
                {
                    var userAssigned = ctx.Users.Where(u => u.Id == bug.AssignedUser.Id).SingleOrDefault();
                    oldBug.AssignedUser = userAssigned;
                }

                oldBug.CreatedBy = userCreated;
                oldBug.Project   = assignedProject;

                ctx.Bugs.ApplyCurrentValues(bug);

                ctx.SaveChanges();

                return(bug);
            }
        }
Beispiel #2
0
        public Bug Create(Bug bug)
        {
            bug.DateFound    = DateTime.Now;
            bug.LastModified = DateTime.Now;

            using (var ctx = new WcfEntityContext())
            {
                var project   = ctx.Projects.Where(x => x.Id == bug.Project.Id).SingleOrDefault();
                var createdBy = ctx.Users.Where(u => u.Id == bug.CreatedBy.Id).SingleOrDefault();

                if (bug.AssignedUser != null)
                {
                    var assignedUser = ctx.Users.Where(p => p.Id == bug.AssignedUser.Id).SingleOrDefault();
                    bug.AssignedUser = assignedUser;
                }

                bug.CreatedBy = createdBy;
                bug.Project   = project;

                ctx.Bugs.AddObject(bug);
                ctx.SaveChanges();

                return(bug);
            }
        }
        public Project Create(Project project)
        {
            using (var ctx = new WcfEntityContext())
            {
                ctx.Projects.AddObject(project);
                ctx.SaveChanges();

                return(project);
            }
        }
Beispiel #4
0
        public void Delete(User user)
        {
            using (var ctx = new WcfEntityContext())
            {
                ctx.AttachTo("Users", user);
                ctx.Users.DeleteObject(user);

                ctx.SaveChanges();
            }
        }
Beispiel #5
0
        public Role Update(Role role)
        {
            using (var ctx = new WcfEntityContext())
            {
                ctx.AttachModify("Roles", role);
                ctx.SaveChanges();

                return(role);
            }
        }
Beispiel #6
0
        public Role Create(Role role)
        {
            using (var ctx = new WcfEntityContext())
            {
                ctx.Roles.AddObject(role);
                ctx.SaveChanges();

                return(role);
            }
        }
        public Project Update(Project project)
        {
            using (var ctx = new WcfEntityContext())
            {
                ctx.AttachModify("Projects", project);
                ctx.SaveChanges();

                return(project);
            }
        }
Beispiel #8
0
        public User Update(User user)
        {
            using (var ctx = new WcfEntityContext())
            {
                ctx.AttachModify("Users", user);

                ctx.SaveChanges();

                return(user);
            }
        }
Beispiel #9
0
        public User Create(User user)
        {
            using (var ctx = new WcfEntityContext())
            {
                ctx.Users.AddObject(user);

                ctx.SaveChanges();

                return(user);
            }
        }
Beispiel #10
0
        public UserProjectSignup Create(UserProjectSignup projSignup)
        {
            using (var ctx = new WcfEntityContext())
            {
                ctx.UserProjectSignup.AddObject(projSignup);

                ctx.SaveChanges();

                return(projSignup);
            }
        }
Beispiel #11
0
        public void Delete(Role role)
        {
            using (var ctx = new WcfEntityContext())
            {
                Role myrole = ctx.Roles.Where(p => p.Id == role.Id).FirstOrDefault();
                ctx.Roles.Attach(myrole);
                ctx.Roles.DeleteObject(myrole);

                ctx.SaveChanges();
            }
        }
Beispiel #12
0
        public void Delete(BugActionLog log)
        {
            using (var ctx = new WcfEntityContext())
            {
                BugActionLog logEntity = ctx.BugActionLogs.Where(p => p.Id == log.Id).FirstOrDefault();
                ctx.BugActionLogs.Attach(logEntity);
                ctx.BugActionLogs.DeleteObject(logEntity);

                ctx.SaveChanges();
            }
        }
Beispiel #13
0
        public void Delete(Bug bug)
        {
            using (var ctx = new WcfEntityContext())
            {
                Bug mybug = ctx.Bugs.Where(p => p.Id == bug.Id).FirstOrDefault();
                ctx.Bugs.Attach(mybug);
                ctx.Bugs.DeleteObject(mybug);

                ctx.SaveChanges();
            }
        }
Beispiel #14
0
        public ProjectRole Create(ProjectRole projRole)
        {
            using (var ctx = new WcfEntityContext())
            {
                ctx.ProjectRole.AddObject(projRole);

                ctx.SaveChanges();

                return(projRole);
            }
        }
Beispiel #15
0
        public void Delete(UserProjectSignup projRole)
        {
            using (var ctx = new WcfEntityContext())
            {
                var entityToDelete = ctx.UserProjectSignup.Where(p => p.ProjectId == projRole.ProjectId &&
                                                                 p.UserId == projRole.UserId &&
                                                                 p.RoleId == projRole.RoleId).SingleOrDefault();

                ctx.UserProjectSignup.DeleteObject(entityToDelete);
                ctx.SaveChanges();
            }
        }
        public void Delete(Project project)
        {
            using (var ctx = new WcfEntityContext())
            {
                var proj = Context.Projects.Where(p => p.Id == project.Id).SingleOrDefault();

                ctx.AttachTo("Projects", proj);
                ctx.Projects.DeleteObject(proj);

                ctx.SaveChanges();
            }
        }
Beispiel #17
0
        public BugActionLog Create(BugActionLog log)
        {
            log.Date = DateTime.Now;

            using (var ctx = new WcfEntityContext())
            {
                log.Action  = ctx.Actions.Where(p => p.Id == log.Action.Id).SingleOrDefault();
                log.Project = ctx.Projects.Where(p => log.Project.Id == p.Id).SingleOrDefault();

                ctx.BugActionLogs.AddObject(log);

                ctx.SaveChanges();

                return(log);
            }
        }