Esempio n. 1
0
        public ActionResult Create([Bind(Include = "MatchID,Score,TeamWinner,Notes,GameID")] Match match)
        {
            if (ModelState.IsValid)
            {
                db.Match.Add(match);
                db.SaveChanges();

                GameHandler matchHandler = new GameHandler();
                bool winner = matchHandler.calculateScore(match.GameID, match.TeamWinner);

                return RedirectToAction("Index");
            }

            UserHandler UserHandler = new UserHandler();
            var UserProfileInfoID = UserHandler.GetUserLogged().UserProfileInfoID;
            ViewBag.GameID = new SelectList(db.Game.Where(i => (i.GameSerie.UserProfileInfoID == UserProfileInfoID) && (i.GameComplete == false)), "GameID", "Notes");
            return View(match);
        }
Esempio n. 2
0
        public ActionResult Edit(Game game)
        {
            if (ModelState.IsValid)
            {
                db.Entry(game).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            UserHandler userHandler = new UserHandler();
            UserProfileInfo user = userHandler.GetUserLogged();

            GameHandler GameHandler = new GameHandler();
            ViewBag.GameSerieID = GameHandler.SelectGameSeries(user, game);
            ViewBag.Players = new SelectList(user.Groups
                                                 .Where(i => i.DominoesGroupID == user.GroupAdministered)
                                                 .Select(i => i.Users).First(),
                                             "UserProfileInfoID",
                                             "FirstName");
            return View(game);
        }
Esempio n. 3
0
        // GET: Games/Edit/5
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            UserHandler userHandler = new UserHandler();
            UserProfileInfo user = userHandler.GetUserLogged();
            Game game = db.Game.Find(id);
            if (game == null)
            {
                return HttpNotFound();
            }

            GameHandler GameHandler = new GameHandler();
            ViewBag.GameSerieID = GameHandler.SelectGameSeries(user, game);
            ViewBag.Players = new SelectList(user.Groups
                                                 .Where(i => i.DominoesGroupID == user.GroupAdministered)
                                                 .Select(i => i.Users).First(),
                                             "UserProfileInfoID",
                                             "FirstName");
            return View(game);
        }
Esempio n. 4
0
        // GET: Matches/Edit/5
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Match match = db.Match.Find(id);
            if (match == null)
            {
                return HttpNotFound();
            }

            UserHandler UserHandler = new UserHandler();
            var UserProfileInfoID = UserHandler.GetUserLogged().UserProfileInfoID;
            GameHandler GameHandler = new GameHandler();
            ViewBag.GameID = GameHandler.SelectGames(UserProfileInfoID, match.GameID);
            return View(match);
        }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "MatchID,ScoreTeamA,ScoreTeamB,Notes,GameID")] Match match)
 {
     if (ModelState.IsValid)
     {
         db.Entry(match).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     UserHandler UserHandler = new UserHandler();
     var UserProfileInfoID = UserHandler.GetUserLogged().UserProfileInfoID;
     GameHandler GameHandler = new GameHandler();
     ViewBag.GameID = GameHandler.SelectGames(UserProfileInfoID, match.GameID);
     return View(match);
 }