/// <summary> /// Deprecated Method for adding a new object to the StandardPicks EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToStandardPicks(StandardPick standardPick) { base.AddObject("StandardPicks", standardPick); }
public void SaveStandardPicks(MyPredictViewModel vm, string userId) { var cwp = _ctx.StandardPicks.GetCurrentWeekStandardPicks(vm.CurrentWeek).ToList(); // if (cwp.Count > 0) { foreach (var standardPick in cwp) { standardPick.Active = false; standardPick.UpdateBy = userId; standardPick.UpdateDate = DateTime.Now; } // } // foreach (var pick in vm.MyPicks) { if (pick.Game != null && pick.Game.Id > 0 && pick.Team != null && pick.Team.Id > 0) { var p = new StandardPick() { Game_Id = pick.Game.Id, PointTotal = pick.PointTotal, Team_Id = pick.Team.Id, UpdateBy = userId, UpdateDate = DateTime.Now, Active = true }; // _ctx.AddToStandardPicks(p); } } // var cwpp = _ctx.StandardPlayoffSuperbowlPicks.GetCurrentWeekPlayoffStandardPicks(vm.CurrentWeek).ToList(); if (cwpp.Count > 0) { foreach (var standardPick in cwpp) { standardPick.Active = false; standardPick.UpdateBy = userId; standardPick.UpdateDate = DateTime.Now; } // } // foreach (var pick in vm.MyPlayoffPicks) { var p = new StandardPlayoffSuperbowlPick() { IsPlayoff = true, Active = true, Week = vm.CurrentWeek, PointTotal = (_ctx.Games.GetMaxRegularSeasonWeekCurrentSeason() - vm.CurrentWeek) + 1, Season_Id = vm.TheSeason.Id, Team_Id = pick.Team.Id, UpdateBy = userId, UpdateDate = DateTime.Now }; // _ctx.AddToStandardPlayoffSuperbowlPicks(p); } // var cwsp = _ctx.StandardPlayoffSuperbowlPicks.GetCurrentWeekSuperbowlStandardPicks(vm.CurrentWeek); if (cwpp.Count > 0) { foreach (var standardPick in cwsp) { standardPick.Active = false; standardPick.UpdateBy = userId; standardPick.UpdateDate = DateTime.Now; } // } // foreach (var pick in vm.MySuperbowlPicks) { var p = new StandardPlayoffSuperbowlPick() { IsSuperbowl = true, Active = true, Week = vm.CurrentWeek, PointTotal = ((_ctx.Games.GetMaxRegularSeasonWeekCurrentSeason() - vm.CurrentWeek) + 1)*2, Season_Id = vm.TheSeason.Id, Team_Id = pick.Team.Id, UpdateBy = userId, UpdateDate = DateTime.Now }; // _ctx.AddToStandardPlayoffSuperbowlPicks(p); } // _ctx.SaveChanges(); // }
/// <summary> /// Create a new StandardPick object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="pointTotal">Initial value of the PointTotal property.</param> /// <param name="team_Id">Initial value of the Team_Id property.</param> /// <param name="game_Id">Initial value of the Game_Id property.</param> public static StandardPick CreateStandardPick(global::System.Int32 id, global::System.Int32 pointTotal, global::System.Int32 team_Id, global::System.Int32 game_Id) { StandardPick standardPick = new StandardPick(); standardPick.Id = id; standardPick.PointTotal = pointTotal; standardPick.Team_Id = team_Id; standardPick.Game_Id = game_Id; return standardPick; }