Ejemplo n.º 1
0
        public async Task<ActionResult> PublishAssignments(PublishSlotAssignmentsViewModel model)
        {
            if (model.Publish)
            {
                var ident = HttpContext.User.Identity as ClaimsIdentity;
                var currentTournamentId = (await (userManager.FindByIdAsync(ident.GetUserId()))).CurrentTournamentId;
                var user = userManager.FindById(ident.GetUserId());
                Tournament tournament = unitOfWork.GetRepository<Tournament>().GetById(currentTournamentId);

                if (ModelState.IsValid && model.PaymentsDueDate != null)
                {
                    // Find currentTournament


                    if (tournament == null)
                    {
                        return RedirectToAction("Index", "Home");
                    }
                    String paymentPageUrl = HttpContext.Request.Url.GetLeftPart(UriPartial.Authority) +
                        Url.Action("Display", "TournamentRegistration", new
                        {
                            Area = "",
                            tournamentId = "{0}",   // will be filled by slotManager
                            organizationId = "{1}",  // will be filled by slotManager
                            tab = "account",
                        });
                    paymentPageUrl = HttpContext.Server.UrlDecode(paymentPageUrl);
                    slotManager.PublishAssignments(tournament.Id, (DateTime)model.PaymentsDueDate, paymentPageUrl, user);
                }
                else
                {
                    model.SlotAssignments = GetSlotAssignmentChanges(tournament, user);
                    return View(model);
                }
            }
            return RedirectToAction("Index");
        }
Ejemplo n.º 2
0
        // GET: TournamentManagement/Slots/PublishResults
        public async Task<ActionResult> PublishAssignments()
        {
            // Find currentTournament

            var ident = HttpContext.User.Identity as ClaimsIdentity;
            var currentTournamentId = (await (userManager.FindByIdAsync(ident.GetUserId()))).CurrentTournamentId;
            var user = unitOfWork.GetRepository<User>().GetById(ident.GetUserId());
            Tournament tournament = unitOfWork.GetRepository<Tournament>().GetById(currentTournamentId);

            if (tournament == null)
            {
                return RedirectToAction("Index", "Home");
            }

            PublishSlotAssignmentsViewModel viewModel = new PublishSlotAssignmentsViewModel
            {
                SlotAssignments = GetSlotAssignmentChanges(tournament, user),
                PaymentsDueDate = null,
                Publish = false
            };

            return View(viewModel);
        }