コード例 #1
0
        public ActionResult Update(int tournamentId)
        {
            if (account.IsLoggedIn())
            {
                Models.Tournament tourny = new Models.Tournament(service, tournamentId);
                if (tourny.IsAdmin(account.Model.AccountID))
                {
                    ViewBag.Create     = false;
                    ViewBag.CanEdit    = tourny.CanEdit();
                    ViewBag.InProgress = tourny.Model.InProgress;
                    tourny.SetFields();
                    return(View("Create", tourny.viewModel));
                }
                else
                {
                    Session["Message"]       = "You do not have permission to do that.";
                    Session["Message.Class"] = ViewError.ERROR;

                    return(RedirectToAction("Tournament", "Tournament", new { guid = tourny.Model.TournamentID }));
                }
            }
            else
            {
                Session["Message"]       = "You need to login to do that";
                Session["Message.Class"] = ViewError.ERROR;

                return(RedirectToAction("Login", "Account"));
            }
        }