Example #1
0
		private void detach_Games3(Game entity)
		{
			this.SendPropertyChanging();
			entity.Player3 = null;
		}
Example #2
0
 partial void DeleteGame(Game instance);
Example #3
0
		private void attach_Games3(Game entity)
		{
			this.SendPropertyChanging();
			entity.Player3 = this;
		}
Example #4
0
 partial void UpdateGame(Game instance);
Example #5
0
 partial void InsertGame(Game instance);
Example #6
0
 public void Delete(Game game)
 {
     db.Games.DeleteOnSubmit(game);
 }
Example #7
0
 //Insert/Delete/Update
 public void Add(Game game)
 {
     db.Games.InsertOnSubmit(game);
 }
Example #8
0
        public ActionResult Play(int blue1, int blue2, int red1, int red2, bool? isTest = false)
        {
            var blue1StartDefCount = GetDefCount(blue1);
            var blue2StartDefCount = GetDefCount(blue2);
            var red1StartDefCount = GetDefCount(red1);
            var red2StartDefCount = GetDefCount(red2);

            int blueOff = blue1,
                blueDef = blue2,
                redOff = red1,
                redDef = red2;

            if (blue1StartDefCount < blue2StartDefCount)
            {
                blueDef = blue2;
                blueOff = blue1;
            }

            if (red1StartDefCount < red2StartDefCount)
            {
                redDef = red2;
                redOff = red1;
            }

            var game = new Game()
            {
                Blue1 = blueDef,
                Blue2 = blueOff,
                Red1 = redDef,
                Red2 = redOff,
                DateStart = DateTime.Now,
                DateEnd = DateTime.Now,
                IsTest = isTest.Value
            };

            var status = string.Format(GetStartTweet(),
                                       playerRep.GetPlayer(blue1),
                                       playerRep.GetPlayer(blue2),
                                       playerRep.GetPlayer(red1),
                                       playerRep.GetPlayer(red2));

            Tweet(status);

            gameRep.Add(game);
            gameRep.Save();

            return RedirectToAction("Play", "Home",  new { BlueDef = blueDef,
                                                           BlueOff = blueOff,
                                                           RedDef = redDef,
                                                           RedOff = redOff,
                                                           GameID = game.ID });
        }