Ejemplo n.º 1
0
        public void Delete(Guid userId, Guid teamId)
        {
            var id = IdByUserAndTeam(userId, teamId);

            var efUserTeam = new Pb.Dal.UserTeam()
                                 {
                                     Id = id,
                                     Deleted = true
                                 };

            using (var db = new Pb.Dal.EfEntities())
            {
                db.UserTeams.Attach(efUserTeam);
                db.Entry(efUserTeam).Property(x => x.Deleted).IsModified = true;

                db.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        public void DeleteByUserTeamId(Guid userTeamId)
        {
            using (var db = new Pb.Dal.EfEntities())
            {
                var efUserTeam = new Pb.Dal.UserTeam()
                                     {
                                         Id = userTeamId,
                                         Deleted = true,
                                         Modified = DateTime.Now
                                     };

                db.UserTeams.Attach(efUserTeam);
                db.Entry(efUserTeam).Property(x => x.Deleted).IsModified = true;
                db.Entry(efUserTeam).Property(x => x.Modified).IsModified = true;

                db.SaveChanges();

            }
        }
Ejemplo n.º 3
0
        public void SetDefault(Guid userId, Guid teamId)
        {
            var id = IdByUserAndTeam(userId, teamId);

            var efUserTeam = new Pb.Dal.UserTeam()
                                     {
                                         Id = id,
                                         Default = true
                                     };

            using (var db = new Pb.Dal.EfEntities())
            {
                // Set all of our current relationsips to false if they are true
                db.UserTeams.Where(x => x.UserId == userId && x.Deleted == false && x.Default == true).Update(y=> new Pb.Dal.UserTeam() {Default = false});

                db.UserTeams.Attach(efUserTeam);
                db.Entry(efUserTeam).Property(x => x.Default).IsModified = true;

                db.SaveChanges();
            }
        }