public ActionResult DeleteConfirmed(int id) { TotalOffense gameOffense = db.GameOffenses.Find(id); db.GameOffenses.Remove(gameOffense); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Game,PlayerID,CoachID,PlateAppearances,Singles,Doubles,Triples,HRs,TotalBases,Walks,HBP,Scrifices,OnByFeildersChoice,OnByInterference,DroppedThirdStrike,StolenBases,StolenBaseAttempts,SO,OtherBattingOuts,RBIs,RunsScored")] TotalOffense gameOffense) { if (ModelState.IsValid) { db.Entry(gameOffense).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PlayerID = new SelectList(db.Players, "PlayerID", "FirstName", gameOffense.PlayerID); return(View(gameOffense)); }
// GET: GameOffenses/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TotalOffense gameOffense = db.GameOffenses.Find(id); if (gameOffense == null) { return(HttpNotFound()); } return(View(gameOffense)); }
// GET: GameOffenses/Create public void Create(int PlayerID, int CoachID, int PlateAppearances, int Singles, int Doubles, int Triples, int HRs, int Walks, int HBP, int Scrifices, int OnByFeildersChoice, int TotalBases, int OnByInterference, int DroppedThirdStrike, int StolenBases, int StolenBaseAttempts, int SO, int OtherBattingOuts, int RBIs, int RunsScored, TotalOffense stats) { stats.PlayerID = PlayerID; stats.CoachID = CoachID; stats.PlateAppearances = PlateAppearances; stats.Singles = Singles; stats.Doubles = Doubles; stats.Triples = Triples; stats.HRs = HRs; stats.Walks = Walks; stats.HBP = HBP; stats.Scrifices = Scrifices; stats.OnByFeildersChoice = OnByFeildersChoice; stats.TotalBases = TotalBases; stats.OnByInterference = OnByInterference; stats.DroppedThirdStrike = DroppedThirdStrike; stats.StolenBases = StolenBases; stats.StolenBaseAttempts = StolenBaseAttempts; stats.SO = SO; stats.OtherBattingOuts = OtherBattingOuts; stats.RBIs = RBIs; stats.RunsScored = RunsScored; db.GameOffenses.Add(stats); db.SaveChanges(); }
public ActionResult Create([Bind(Include = "Game,PlayerID,CoachID,PlateAppearances,Singles,Doubles,Triples,HRs,Walks,HBP,Scrifices,OnByFeildersChoice,TotalBases,OnByInterference,DroppedThirdStrike,StolenBases,StolenBaseAttempts,SO,OtherBattingOuts,RBIs,RunsScored")] SubmitOffense subOffense, OffenseStats offenseStats, TotalOffense totalOff) { if (ModelState.IsValid) { string user = User.Identity.GetUserId(); var coachRow = from row in db.Coaches where row.UserId == user select row; var coachRowResult = coachRow.FirstOrDefault(); subOffense.CoachID = coachRowResult.CoachID; TotalOffensesController total = new TotalOffensesController(); MorphingTables morph = new MorphingTables(); OffenseStatsController off = new OffenseStatsController(); db.SubmitOffenses.Add(subOffense); db.SaveChanges(); foreach (var item in db.GameOffenses) { if (item.PlayerID == subOffense.PlayerID) { total.Edit(subOffense.PlayerID, subOffense.CoachID, subOffense.PlateAppearances, subOffense.Singles, subOffense.Doubles, subOffense.Triples, subOffense.HRs, subOffense.Walks, subOffense.HBP, subOffense.Scrifices, subOffense.OnByFeildersChoice, subOffense.TotalBases, subOffense.OnByInterference, subOffense.DroppedThirdStrike, subOffense.StolenBases, subOffense.StolenBaseAttempts, subOffense.SO, subOffense.OtherBattingOuts, subOffense.RBIs, subOffense.RunsScored); return(RedirectToAction("Home", "Coaches")); } } total.Create(subOffense.PlayerID, subOffense.CoachID, subOffense.PlateAppearances, subOffense.Singles, subOffense.Doubles, subOffense.Triples, subOffense.HRs, subOffense.Walks, subOffense.HBP, subOffense.Scrifices, subOffense.OnByFeildersChoice, subOffense.TotalBases, subOffense.OnByInterference, subOffense.DroppedThirdStrike, subOffense.StolenBases, subOffense.StolenBaseAttempts, subOffense.SO, subOffense.OtherBattingOuts, subOffense.RBIs, subOffense.RunsScored, totalOff); off.Create(totalOff.PlayerID, totalOff.CoachID, totalOff.PlateAppearances, totalOff.Singles, totalOff.Doubles, totalOff.Triples, totalOff.HRs, totalOff.Walks, totalOff.HBP, totalOff.Scrifices, totalOff.OnByFeildersChoice, totalOff.TotalBases, totalOff.OnByInterference, totalOff.DroppedThirdStrike, totalOff.StolenBases, totalOff.StolenBaseAttempts, totalOff.SO, totalOff.OtherBattingOuts, totalOff.RBIs, totalOff.RunsScored); return(RedirectToAction("Home", "Coaches")); } ViewBag.PlayerID = new SelectList(db.Players, "PlayerID", "FirstName", subOffense.PlayerID); return(View(subOffense)); }