Exemplo n.º 1
0
 // GET: Matches/Create
 public ActionResult Create()
 {
     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();
 }
Exemplo n.º 2
0
        // GET: Games/Create
        public ActionResult Create()
        {
            UserHandler userHandler = new UserHandler();
            UserProfileInfo user = userHandler.GetUserLogged();
            ViewBag.GameSerieID = new SelectList(user.GameSeries, "GameSerieID", "Name");
            ViewBag.Players = new SelectList(user.Groups
                                                 .Where(i => i.DominoesGroupID == user.GroupAdministered)
                                                 .Select(i => i.Users).First(),
                                             "UserProfileInfoID",
                                             "FirstName");

            return View();
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        public ActionResult Create([Bind(Include = "GameSerieID,Name,Notes,GameWinner,PollonaValue,ViajeroValue")] GameSerie gameSerie)
        {
            //gameSerie.UserProfileInfo = db.UserProfileInfo.First();  // No needed

            UserHandler UserHandler = new UserHandler();
            var User = UserHandler.GetUserLogged();
            gameSerie.UserProfileInfoID = User.UserProfileInfoID;

            if (ModelState.IsValid)
            {
                db.GameSerie.Add(gameSerie);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.UserProfileInfoID = new SelectList(db.UserProfileInfo, "UserProfileInfoID", "FirstName", gameSerie.UserProfileInfoID);
            return View(gameSerie);
        }
Exemplo n.º 5
0
        public ActionResult Create(Game game)
        {
            if (ModelState.IsValid)
            {
                db.Game.Add(game);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            UserHandler userHandler = new UserHandler();
            UserProfileInfo user = userHandler.GetUserLogged();
            ViewBag.GameSerieID = new SelectList(user.GameSeries, "GameSerieID", "Name");
            ViewBag.Players = new SelectList(user.Groups
                                                 .Where(i => i.DominoesGroupID == user.GroupAdministered)
                                                 .Select(i => i.Users).First(),
                                             "UserProfileInfoID",
                                             "FirstName");
            return View(game);
        }
Exemplo n.º 6
0
 // GET: Games
 public ActionResult Index()
 {
     UserHandler UserHandler = new UserHandler();
     var UserProfileInfoID = UserHandler.GetUserLogged().UserProfileInfoID;
     var game = db.Game.Include(g => g.GameSerie)
                       .Where( g => g.GameSerie.UserProfileInfoID == UserProfileInfoID);
     return View(game.ToList());
 }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
 // GET: Matches
 public ActionResult Index()
 {
     UserHandler UserHandler = new UserHandler();
     var UserProfileInfoID = UserHandler.GetUserLogged().UserProfileInfoID;
     var match = db.Match.Include(m => m.Game)
                   .Where( m => m.Game.GameSerie.UserProfileInfoID == UserProfileInfoID);
     return View(match.ToList());
 }
Exemplo n.º 11
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);
 }
Exemplo n.º 12
0
        // GET: GameSeries
        public ActionResult Index()
        {
            UserHandler UserHandler = new UserHandler();
            var User = UserHandler.GetUserLogged();

            var gameSerie = User.GameSeries;
            return View(gameSerie.ToList());
        }