public ActionResult DeleteConfirmed(int id) { Arbs_Football_MatchWinner footballarb = db.Arbs_Football_MatchWinner.Find(id); db.Arbs_Football_MatchWinner.Remove(footballarb); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /FootballArb/Details/5 public ActionResult Details(int id = 0) { Arbs_Football_MatchWinner footballarb = db.Arbs_Football_MatchWinner.Find(id); if (footballarb == null) { return(HttpNotFound()); } return(View(footballarb)); }
public ActionResult Edit(Arbs_Football_MatchWinner footballarb) { if (ModelState.IsValid) { db.Entry(footballarb).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(footballarb)); }
public ActionResult Create(Arbs_Football_MatchWinner footballarb) { if (ModelState.IsValid) { db.Arbs_Football_MatchWinner.Add(footballarb); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(footballarb)); }
private void WriteArbToDatabase(DateTime matchDateTime, string homeTeam, string awayTeam, string betFairLevel, decimal betFairLayOdds, decimal betFairCash, DateTime betFairUpdated, string bookie, decimal bookieOdds, DateTime oddsCheckerUpdated, string prediction, int fixtureID) { // Check if arb exists already var record = barbieEntity.Arbs_Football_MatchWinner .Where(x => x.Expired == false || x.Expired == null) .Where(x => x.FixtureMapID == fixtureID) .Where(x => x.BetFairLayLevel == betFairLevel) .Where(x => x.BetFairOdds == betFairLayOdds) .Where(x => x.BetFairCash == betFairCash) .Where(x => x.Bookie == bookie) .Where(x => x.BookieOdds == bookieOdds) .Where(x => x.Predication == prediction) .FirstOrDefault(); // Update existing arb if (record != null) { record.BetFairUpdated = DateTime.Now; record.OddsCheckerUpdated = DateTime.Now; record.Updated = DateTime.Now; barbieEntity.SaveChanges(); return; } // Check if arb has been updated, if so, set parentID and expired values for old arb and write new record record = barbieEntity.Arbs_Football_MatchWinner .Where(x => x.Expired == false || x.Expired == null) .Where(x => x.FixtureMapID == fixtureID) .Where(x => x.BetFairLayLevel == betFairLevel) .Where(x => x.Bookie == bookie) .Where(x => x.Predication == prediction) .FirstOrDefault(); int?parentID = null; if (record != null) { parentID = record.ID; } var arb = new Arbs_Football_MatchWinner(); arb.MatchDateTime = matchDateTime; arb.HomeTeam = homeTeam; arb.AwayTeam = awayTeam; arb.BetFairLayLevel = betFairLevel; arb.BetFairOdds = betFairLayOdds; arb.BetFairCash = betFairCash; arb.BetFairUpdated = betFairUpdated; arb.Bookie = bookie; arb.BookieOdds = bookieOdds; arb.OddsCheckerUpdated = oddsCheckerUpdated; arb.Predication = prediction; arb.FixtureMapID = fixtureID; arb.Created = DateTime.Now; arb.ParentID = parentID; barbieEntity.Arbs_Football_MatchWinner.Add(arb); barbieEntity.SaveChanges(); if (record != null) { record.Expired = true; record.Updated = DateTime.Now; barbieEntity.SaveChanges(); } }