/// <summary> /// Create a new PlayoffSuperbowlPick object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="userId">Initial value of the UserId property.</param> /// <param name="pointTotal">Initial value of the PointTotal property.</param> /// <param name="week">Initial value of the Week property.</param> /// <param name="season_Id">Initial value of the Season_Id property.</param> /// <param name="isSuperbowl">Initial value of the IsSuperbowl property.</param> /// <param name="isPlayoff">Initial value of the IsPlayoff property.</param> /// <param name="isWinner">Initial value of the IsWinner property.</param> /// <param name="team_Id">Initial value of the Team_Id property.</param> public static PlayoffSuperbowlPick CreatePlayoffSuperbowlPick(global::System.Int32 id, global::System.String userId, global::System.Int32 pointTotal, global::System.Int32 week, global::System.Int32 season_Id, global::System.Boolean isSuperbowl, global::System.Boolean isPlayoff, global::System.Boolean isWinner, global::System.Int32 team_Id) { PlayoffSuperbowlPick playoffSuperbowlPick = new PlayoffSuperbowlPick(); playoffSuperbowlPick.Id = id; playoffSuperbowlPick.UserId = userId; playoffSuperbowlPick.PointTotal = pointTotal; playoffSuperbowlPick.Week = week; playoffSuperbowlPick.Season_Id = season_Id; playoffSuperbowlPick.IsSuperbowl = isSuperbowl; playoffSuperbowlPick.IsPlayoff = isPlayoff; playoffSuperbowlPick.IsWinner = isWinner; playoffSuperbowlPick.Team_Id = team_Id; return playoffSuperbowlPick; }
public void SetupNewUserMidSeason(string userId) { // get the standard picks for the weeks prior var sPicks = _ctx.StandardPicks.Where(p => p.Game.GameDateTime < DateTime.Now && p.Active != null && p.Active.Value && p.Game.Season.IsCurrent).ToList(); var sspPicks = _ctx.StandardPlayoffSuperbowlPicks.Where(p => p.Active != null && p.Active.Value && p.Season.IsCurrent).ToList(); foreach (var sp in sPicks) { var pick = new Pick() { Game = sp.Game, PointTotal = sp.PointTotal, Team_Id = sp.Team_Id, UpdateBy = "new_user_add", UpdateDate = DateTime.Now, UserId = userId, IsWinner = sp.IsWinner }; // add the new pick to the context _ctx.AddToPicks(pick); } // playoff var season = _ctx.Seasons.Where(s => s.IsCurrent).SingleOrDefault(); foreach (var sp in sspPicks) { var pick = new PlayoffSuperbowlPick() { IsPlayoff = sp.IsPlayoff, IsSuperbowl = sp.IsSuperbowl, Week = sp.Week, PointTotal = sp.PointTotal, UserId = userId, Season = season, Team_Id = sp.Team_Id }; // add to context _ctx.AddToPlayoffSuperbowlPicks(pick); } // save _ctx.SaveChanges(); }
/// <summary> /// Deprecated Method for adding a new object to the PlayoffSuperbowlPicks EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPlayoffSuperbowlPicks(PlayoffSuperbowlPick playoffSuperbowlPick) { base.AddObject("PlayoffSuperbowlPicks", playoffSuperbowlPick); }