コード例 #1
0
        public ActionResult SetEstimatedResults()
        {
            if (DateTime.Now >= new DateTime(2020, 6, 12, 21, 0, 0))
            {
                return(View("OverDeadlineView"));
            }

            if (EstimatedResultController.GetEstimatedResultModelsForUser(User.Identity.GetUserId()).Any())
            {
                return(View("JustOnceView"));
            }

            try
            {
                ViewBag.Matches = MatchesController.GetMatches();

                ViewBag.EstimatedResults = new EstimatedResultForUser
                                               (EstimatedResultController.GetEstimatedResultModelsForUser(User.Identity.GetUserId()));
                ViewBag.Message = "OK";
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
            }
            return(View("SetResultsView"));
        }
コード例 #2
0
        public ActionResult Index()
        {
            if (!Request.IsAuthenticated)
            {
                return(View());
            }

            try
            {
                ViewBag.Matches          = MatchesController.GetMatches();
                ViewBag.EstimatedResults = new EstimatedResultForUser
                                               (EstimatedResultController.GetEstimatedResultModelsForUser(User.Identity.GetUserId()));
                ViewBag.Ranking = RankingController.GetRanking();
                ViewBag.Users   = new Users(HttpContext.GetOwinContext()
                                            .GetUserManager <Identity.ApplicationUserManager>()
                                            .Users.ToList());

                ViewBag.Message = "OK";
            }
            catch (Exception ex)
            {
                ViewBag.Message = ex.Message;
            }

            return(View());
        }
コード例 #3
0
 public ActionResult Index()
 {
     ViewBag.Message = "Admin page";
     ViewBag.Users   = HttpContext.GetOwinContext()
                       .GetUserManager <Identity.ApplicationUserManager>()
                       .Users.ToList();
     ViewBag.Matches = MatchesController.GetMatches();
     return(View());
 }
コード例 #4
0
        public ActionResult DeleteMatch(int matchId)
        {
            var match = MatchesController.GetMatches().First(x => x.Id == matchId);

            if (ResultController.GetResult(match.ResultId).IsImported == 1)
            {
                ResultController.DeleteResultForMatch(match.ResultId);
            }

            MatchesController.DeleteMatch(matchId);
            return(RedirectToAction("Index", "Admin"));
        }
コード例 #5
0
ファイル: TipsTable.cs プロジェクト: kuchta1212/TipTournament
        private void CreateRows(List <ApplicationUser> users)
        {
            int row = 0;
            int col = 0;

            //ViewBag.EstimatedResults = new EstimatedResultForUser(EstimatedResultController.GetEstimatedResultModels());
            List <MatchModel>        matches   = MatchesController.GetMatches();
            Dictionary <int, string> helpUsers = new Dictionary <int, string>();

            //table header
            TipsTableRow header = new TipsTableRow(row);

            header.AddCell(col, string.Empty);
            col++;
            header.AddCell(col, string.Empty);
            col++;
            foreach (ApplicationUser user in users)
            {
                helpUsers.Add(col, user.Id);
                header.AddCell(col, user.UserName);
                col++;
            }
            this.rows.Add(header);
            row++;

            int colOverAll = users.Count + 2;

            //table data
            foreach (MatchModel match in matches)
            {
                col = 2;

                TipsTableRow tipRow = new TipsTableRow(row);
                tipRow.AddCell(0, match.TeamOne);
                tipRow.AddCell(1, match.TeamTwo);
                for (int i = 2; i < colOverAll; i++)
                {
                    string userId = helpUsers[i];
                    var    model  = EstimatedResultController.GetEstimatedResultModelForUserAndMatch(userId, match.Id);

                    string content = model != null?model.ToString() : string.Empty;

                    tipRow.AddCell(col, content);
                    col++;
                }
                this.rows.Add(tipRow);
                row++;
            }

            this.Rows    = this.rows.Count;
            this.Columns = colOverAll;
        }