Пример #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();
 }
Пример #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();
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #6
0
 // GET: Games/Details/5
 public ActionResult Details(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     Game game = db.Game.Find(id);
     UserHandler UserHandler = new UserHandler();
     ViewBag.NamesInGame = UserHandler.GetNamesInGame(game);
     if (game == null)
     {
         return HttpNotFound();
     }
     return View(game);
 }
Пример #7
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());
 }
Пример #8
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);
        }
Пример #9
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);
        }
Пример #10
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);
        }
Пример #11
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());
 }
Пример #12
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);
 }
Пример #13
0
        // GET: DominoesGroups
        public ActionResult Index()
        {
            //var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()));
            //var currentuser = manager.FindById(User.Identity.GetUserId());
            // Get the users list for Administered Group
            //var GroupUsersList = db.DominoesGroup
            //                       .Include(i => i.Users)
            //                       .Where(i => i.DominoesGroupID == currentuser.UserProfileInfo.GroupAdministered)
            //                       .Single();

            UserHandler UserHandler = new UserHandler();
            return View(new[] { UserHandler.GetGroupAdministered() });
        }
Пример #14
0
        // GET: GameSeries
        public ActionResult Index()
        {
            UserHandler UserHandler = new UserHandler();
            var User = UserHandler.GetUserLogged();

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