Ejemplo n.º 1
0
        public static int AddUsrOptions(string user, int week, string gameKey, string gamePick)
        {
            NFLUsrPicks data = new NFLUsrPicks
            {
                UserID   = user,
                Week     = week,
                GameKey  = gameKey,
                GamePick = gamePick
            };

            string sql = @"INSERT INTO dbo.usrPicks (UserID, Week, GameKey, GamePick)
                           VALUES (@UserID, @Week, @GameKey, @GamePick);";


            return(SqlDataAccess.SaveData(sql, data));
        }
Ejemplo n.º 2
0
        public static int PopulateUsrPicks(string userID, int week, string gameKey, string gamePick)
        {
            NFLUsrPicks data = new NFLUsrPicks
            {
                UserID   = userID,
                Week     = week,
                GameKey  = gameKey,
                GamePick = gamePick
            };

            string sql = @"IF EXISTS (SELECT * FROM dbo.usrPicks WHERE GameKey = @GameKey AND UserID = @UserID)
                             BEGIN
                                UPDATE dbo.usrPicks SET UserID = @UserID, Week = @Week, GameKey = @GameKey, GamePick = @GamePick 
                                                    WHERE GameKey = @GameKey AND UserID = @UserID;
                             END
                           ELSE
                             BEGIN
                                INSERT INTO dbo.usrPicks (UserID, Week, GameKey, GamePick)
                                VALUES(@UserID, @Week, @GameKey, @GamePick);
                            END";

            return(SqlDataAccess.SaveData(sql, data));
        }