public ActionResult Add(int id = 0) { SharedVM.LogPageHit("Bets/Add", User.Identity.Name); var newBet = new BetObj(); newBet.AB = true; newBet.JK = true; newBet.CL = true; newBet.AT = true; newBet.DV = true; newBet.BetDate = DateTime.Today; newBet.GroupBet = "Y"; if (id == 1) { newBet.Sport = "NFL"; } else if (id == 2) { newBet.Sport = "CFB"; } else { newBet.Sport = ""; } GetDataForDropdowns(ref newBet); return(View(newBet)); }
public void UpdateBetItem(BetObj bet) { var sql = @"update Bets set BetDate=@a, Sport=@b, Details=@c, Risking=@d, ToCollect=@e, DV=@f, CL=@g, AB=@h, JK=@i, AT=@j, Outcome=@l where BetId=@id" ; var queryParams = new { a = bet.BetDate, b = bet.Sport, c = bet.Details, d = bet.Risking, e = bet.ToCollect, f = bet.DV, g = bet.CL, h = bet.AB, i = bet.JK, j = bet.AT, l = bet.Outcome, id = bet.BetId }; IDbConnection db = new SqlConnection(sqlPath); db.Execute(sql, queryParams); }
public void AddNewBet(BetObj bet) { var sql = @"insert into Bets (BetDate, Sport, Details, Risking, ToCollect, DV, CL, AB, JK, AT, Outcome) values (@a, @b, @c, @d, @e, @f, @g, @h, @i, @j, @l)" ; var queryParams = new { a = bet.BetDate, b = bet.Sport, c = bet.Details, d = bet.Risking, e = bet.ToCollect, f = bet.DV, g = bet.CL, h = bet.AB, i = bet.JK, j = bet.AT, l = bet.Outcome }; IDbConnection db = new SqlConnection(sqlPath); db.Execute(sql, queryParams); }
private string FindIfGroupBet(BetObj bet) { if (bet.AB && bet.JK && bet.CL && bet.AT && bet.DV) { return("Y"); } else { return("N"); } }
public ActionResult SaveAndNew(BetObj myBet) { SharedVM.LogPageHit("Bets/Edit/Save(" + myBet.BetId + ")", User.Identity.Name); var vm = new BetsVM(dbConn); if (myBet.BetId > 0) { vm.UpdateBetItem(myBet); } return(RedirectToAction("Add")); }
public ActionResult Edit(BetObj myBet) { SharedVM.LogPageHit("Bets/Edit/Save(" + myBet.BetId + ")", User.Identity.Name); var vm = new BetsVM(dbConn); if (myBet.BetId > 0) { vm.UpdateBetItem(myBet); } var thisSite = vm.GetSingleBet(myBet.BetId); return(View(thisSite)); }
public ActionResult Add(BetObj myBet) { if (ModelState.IsValid) { SharedVM.LogPageHit("Bets/Add/Save (" + myBet.BetId + ")", User.Identity.Name); var vm = new BetsVM(dbConn); vm.AddNewBet(myBet); return(RedirectToAction("Index")); } else { return(View()); } }
public void GetDataForDropdowns(ref BetObj thisBet) { var myList = new List <OutcomeObj> { new OutcomeObj() { OutcomeId = "", Description = "" }, new OutcomeObj() { OutcomeId = "W", Description = "Win" }, new OutcomeObj() { OutcomeId = "L", Description = "Loss" }, new OutcomeObj() { OutcomeId = "P", Description = "Push" } }; thisBet.OutcomesList = myList; }
public void UpdateBetItem(BetObj betObj) { }