コード例 #1
0
 public static int Delete(Guid id)
 {
     try
     {
         using (BoBEntities bob = new BoBEntities())
         {
             tblBracket row     = bob.tblBrackets.FirstOrDefault(c => c.Id == id);
             int        results = 0;
             if (row != null)
             {
                 bob.tblBrackets.Remove(row);
                 results = bob.SaveChanges();
             }
             else
             {
                 throw new Exception("Row was not found");
             }
             return(results);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
        public static int Delete(Guid id)
        {
            using (BoBEntities bob = new BoBEntities())
            {
                tblRelationship row = bob.tblRelationships.FirstOrDefault(r => id == r.Id);

                bob.tblRelationships.Remove(row);

                return(bob.SaveChanges());
            }
        }
コード例 #3
0
        public static int Update(Relationship relationship)
        {
            using (BoBEntities bob = new BoBEntities())
            {
                tblRelationship row = bob.tblRelationships.FirstOrDefault(r => relationship.Id == r.Id);

                row.isFriend = relationship.isFriend;

                return(bob.SaveChanges());
            }
        }
コード例 #4
0
ファイル: MatchManager.cs プロジェクト: VanVelZ/BrackIt
        public static int Delete(Guid id)
        {
            using (BoBEntities bob = new BoBEntities())
            {
                tblMatch row = bob.tblMatches.FirstOrDefault(m => m.Id == id);

                if (row != null)
                {
                    bob.tblMatches.Remove(row);
                }
                return(bob.SaveChanges());
            }
        }
コード例 #5
0
ファイル: MatchManager.cs プロジェクト: VanVelZ/BrackIt
 public static int Update(Match match)
 {
     using (BoBEntities bob = new BoBEntities())
     {
         tblMatch row = bob.tblMatches.FirstOrDefault(m => m.Id == match.Id);
         if (row != null)
         {
             row.Team1           = match.Player1.Id;
             row.Team2           = match.Player2.Id;
             row.Outcome         = match.Winner.Id;
             row.ReportingPlayer = match.ReportingPlayer.Id;
             row.Round           = match.Round;
             row.Division        = match.Division;
         }
         return(bob.SaveChanges());
     }
 }
コード例 #6
0
 public static int Insert(Relationship relationship)
 {
     using (BoBEntities bob = new BoBEntities())
     {
         tblRelationship row = new tblRelationship
         {
             Id         = Guid.NewGuid(),
             SenderId   = relationship.Friend1.Id,
             FriendId   = relationship.Friend2.Id,
             isFriend   = relationship.isFriend,
             FriendDate = DateTime.Now
         };
         relationship.Id = row.Id;
         bob.tblRelationships.Add(row);
         return(bob.SaveChanges());
     }
 }
コード例 #7
0
ファイル: UserManager.cs プロジェクト: VanVelZ/BrackIt
 public static int Insert(User user)
 {
     using (BoBEntities bob = new BoBEntities())
     {
         tblUser row = new tblUser
         {
             Id          = Guid.NewGuid(),
             FirstName   = user.FirstName,
             LastName    = user.LastName,
             Password    = GetHash(user.Password),
             Username    = user.Username,
             ImageSource = user.ImageSource
         };
         bob.tblUsers.Add(row);
         user.Id       = row.Id;
         user.Password = row.Password;
         return(bob.SaveChanges());
     }
 }
コード例 #8
0
ファイル: MatchManager.cs プロジェクト: VanVelZ/BrackIt
 public static int Insert(Match match, Guid bracketid)
 {
     using (BoBEntities bob = new BoBEntities())
     {
         tblMatch row = new tblMatch
         {
             Id              = Guid.NewGuid(),
             Team1           = match.Player1.Id,
             Team2           = match.Player2.Id,
             Outcome         = match.Winner.Id,
             BracketId       = bracketid,
             ReportingPlayer = match.ReportingPlayer.Id,
             Round           = match.Round,
             Division        = match.Division
         };
         match.Id = row.Id;
         bob.tblMatches.Add(row);
         return(bob.SaveChanges());
     }
 }
コード例 #9
0
 public static int Update(Bracket bracket)
 {
     using (BoBEntities bob = new BoBEntities())
     {
         tblBracket row     = bob.tblBrackets.FirstOrDefault(c => c.Id == bracket.Id);
         int        results = 0;
         if (row != null)
         {
             row.Name               = bracket.Name;
             row.ModeratorId        = bracket.Moderator.Id;
             row.ImageSource        = bracket.ImageSource;
             row.OriginalRoundCount = bracket.OriginalRoundCount;
             row.Game               = bracket.Game;
             row.CurrentDivision    = bracket.CurrentDivision;
             results = bob.SaveChanges();
         }
         else
         {
             throw new Exception("Row was not found");
         }
         return(results);
     }
 }
コード例 #10
0
ファイル: UserManager.cs プロジェクト: VanVelZ/BrackIt
        public static int Update(User user)
        {
            using (BoBEntities bob = new BoBEntities())
            {
                tblUser row     = bob.tblUsers.FirstOrDefault(c => c.Id == user.Id);
                int     results = 0;
                if (row != null)
                {
                    row.FirstName   = user.FirstName;
                    row.LastName    = user.LastName;
                    row.Password    = GetHash(user.Password);
                    row.Username    = user.Username;
                    row.ImageSource = user.ImageSource;

                    results = bob.SaveChanges();
                }
                else
                {
                    throw new Exception("Row was not found");
                }
                return(results);
            }
        }
コード例 #11
0
        public static int Insert(Bracket bracket)
        {
            using (BoBEntities bob = new BoBEntities())
            {
                tblBracket row = new tblBracket
                {
                    Id                 = Guid.NewGuid(),
                    Name               = bracket.Name,
                    ImageSource        = bracket.ImageSource,
                    ModeratorId        = bracket.Moderator.Id,
                    Game               = bracket.Game,
                    OriginalRoundCount = bracket.OriginalRoundCount,
                    CurrentDivision    = bracket.CurrentDivision
                };

                bracket.Id = row.Id;
                if (bracket.Matches.Count > 0)
                {
                    bracket.Matches.ForEach(m => MatchManager.Insert(m, bracket.Id));
                }
                bob.tblBrackets.Add(row);
                return(bob.SaveChanges());
            }
        }